Training image-recognition systems based on search queries on online social networks

ABSTRACT

In one embodiment, a method includes receiving a plurality of search queries comprising n-grams; identifying a subset of the plurality of search queries as being queries for visual-media items based on one or more n-grams of the search query being associated with visual-media content; calculating, for each of the n-grams of the search queries of the subset, a popularity-score based on a count of the search queries in the subset that include the n-gram; determining popular n-grams, wherein each of the popular n-grams is an n-gram of the search queries of the subset of search queries having a popularity-score greater than a threshold popularity-score; and selecting one or more of the popular n-grams for training a visual-concept recognition system, wherein each of the popular n-grams is selected based on whether it is associated with a visual concept.

TECHNICAL FIELD

This disclosure generally relates to social graphs and object searchwithin a social-networking environment.

BACKGROUND

A social-networking system, which may include a social-networkingwebsite, may enable its users (such as persons or organizations) tointeract with it and with each other through it. The social-networkingsystem may, with input from a user, create and store in thesocial-networking system a user profile associated with the user. Theuser profile may include demographic information, communication-channelinformation, and information on personal interests of the user. Thesocial-networking system may also, with input from a user, create andstore a record of relationships of the user with other users of thesocial-networking system, as well as provide services (e.g. wall posts,photo-sharing, event organization, messaging, games, or advertisements)to facilitate social interaction between or among users.

The social-networking system may send over one or more networks contentor messages related to its services to a mobile or other computingdevice of a user. A user may also install software applications on amobile or other computing device of the user for accessing a userprofile of the user and other data within the social-networking system.The social-networking system may generate a personalized set of contentobjects to display to a user, such as a newsfeed of aggregated storiesof other users connected to the user.

Social-graph analysis views social relationships in terms of networktheory consisting of nodes and edges. Nodes represent the individualactors within the networks, and edges represent the relationshipsbetween the actors. The resulting graph-based structures are often verycomplex. There can be many types of nodes and many types of edges forconnecting nodes. In its simplest form, a social graph is a map of allof the relevant edges between all the nodes being studied.

SUMMARY OF PARTICULAR EMBODIMENTS

When users search for visual-media items, they often attempt to searchfor visual concepts (i.e., distinct concepts that may be visuallyperceived and recognized by human users in images, such as objects orpersons) within the visual-media items by constructing search queriesthat describe the visual concepts. Constructing search queries in thismanner may be intuitive to users, but may be difficult for a computingsystem to resolve. One problem that arises with such search queries isthe identifying of visual concepts in visual-media items, which can beparticularly difficult without human input. Classifying them may be evenmore difficult, such that identifying visual-media items responsive to asearch query that attempts to describe visual concepts in visual-mediaitems presents a significant challenge. Some current methods simply usea limited—and often noisy—pool of text sources (e.g., text from thetitle, description, comments, reshares, other linked content, etc.) thatmay be associated with visual-media items but may do a poor job ofdescribing the important visual concepts within visual-media items—i.e.,the visual concepts that users may actually search for when attemptingto access visual-media items. Additionally, the text that usersassociate with the visual concepts they intend to search for, andconsequently the text that they use in constructing the correspondingsearch queries, may be difficult to determine. As an example and not byway of limitation, users may construct search queries with slang termsthat are intended to refer to visual concepts, and these slang terms maybe constantly evolving such that a fixed set of keywords for visualconcepts may not be ideal in handling search queries for these visualconcepts. The methods described herein attempt to solve these technicalchallenges associated with searching for visual-media items by using animage-recognition process to segment images of visual-media items andidentify visual concepts therein and by then tying those visual conceptsto text supplied by user communications, where the text is determined tobe likely to describe those visual concepts. The described jointembedding model may be advantageous in that it allows thesocial-networking system to leverage what is effectively crowdsourcedinformation from text associated with visual-media items (e.g., fromcommunications, metadata, etc.) to determine associations betweenn-grams and visual-media items, and ultimately between n-grams andvisual concepts. In this way, the social-networking system may be ableto describe visual concepts based on the n-grams that are associatedwith the visual concepts. This method of describing visual concepts maybe more efficient than other solutions in that it uses a large amount ofexisting information (e.g., information from communications on thesocial-networking system or other information sourced from a largenumber of users) to train a visual-concept recognition system anddescribe concepts appearing in visual-media items, rather than resortingto more processor- and labor-intensive efforts that may be required intraining a system to classify concepts in visual-media items. Thetechnical benefit of this training may be the ability to index visualconcepts with n-grams that users associate with those visual concepts,and ultimately, the ability to efficiently return high-quality searchresults to search queries directed at indexed visual concepts. Thedescribed training process may have the ability to be language-agnostic,which has the technical benefit of not requiring a semanticunderstanding of visual concepts of visual-media items and may therebyreduce the complexities of processing such information. Thelanguage-agnostic nature may also allow for the training process tofunction seamlessly across various languages, so long as associationscan be made between n-grams and visual concepts (or visual media-items).

In particular embodiments, the social-networking system may identify ashared visual concept in two or more visual-media items. Eachvisual-media item may include visual concepts in one or more of itsimages that may be identified based on visual features in the images. Ashared visual concept may be identified in two or more videos based onone or more shared visual features in the respective images of thevisual-media items. The social-networking system may extract, for eachof the visual-media items, one or more n-grams from one or morecommunications associated with the visual-media item. In particularembodiments, the social-networking system may generate, in ad-dimensional space, an embedding for each of the visual-media items,wherein a location of the embedding for the visual-media item is basedon the one or more visual concepts included in the visual-media item.The social-networking system may generate, in the d-dimensional space,an embedding for each of the extracted n-grams, wherein a location ofthe embedding for the n-gram is based on a frequency of occurrence ofthe n-gram in the communications associated with the visual-media items.The social-networking system may associate, with the shared visualconcept, one or more of the extracted n-grams that have embeddingswithin a threshold area of the embeddings for the identifiedvisual-media items. Although the disclosure focuses on visual-mediaitems, it contemplates applying the disclosed methods to other types ofmedia such as audio (e.g., using an audio-recognition process ratherthan an image-recognition process). Furthermore, although the disclosurefocuses on extracting n-grams from communications, it contemplatesextracting n-grams or other suitable units of information from othersources.

The extensive and continuous nature of the training of n-grams tovisual-media items and visual concepts as described herein may introduceseveral challenges for the social-networking system. First, thesocial-networking system may only be able train for a finite number ofvisual concepts within a given period of time, such that thesocial-networking system may be unable to be trained for every possiblevisual concept. Second, new visual concepts and n-grams describing themmay constantly be emerging and the social-networking system may need tobe able to train for these visual concepts as they emerge and becomeimportant to the user base. As an example and not by way of limitation,the n-gram “smartphone” and its associated visual concept may not haveexisted before the first smartphone was released, such that therequisite associations may not have yet been trained for. The methodsdescribed herein attempt to solve problems such as these by usingsearch-query metrics that describe what n-grams are popularly searchedfor, and by extension, what visual concepts are popularly searched for,to strategically select the visual concepts and n-grams to train for.The social-networking system may use search-query metrics to determinewhat n-grams are popular in search queries submitted by users (e.g.,n-grams used in a threshold number of queries) and may then train thosen-grams to their respective visual concepts if they have not alreadybeen trained for. The social-networking system may train these popularn-grams to their respective visual concepts using any suitable methodsuch as the ones described here (e.g., by mapping these n-grams onton-embeddings in the joint embedding model). As an example and not by wayof limitation, if users are frequently submitting search queries thatinclude the n-gram “batman” and if the social-networking system has notassociated that n-gram with a visual concept, the social-networkingsystem may select that n-gram for training. Selecting visual conceptsand n-grams strategically in this manner may provide the technicalbenefit of improving the efficiency of training a visual-conceptrecognition system by training for visual concepts and n-grams that arerelevant to a search functionality. It further ensures that thesocial-networking system trains for the most up-to-date visual concepts.

In particular embodiments, the social-networking system may receive,from a plurality of client systems of a plurality of users, a pluralityof search queries. Each of the search queries may include one or moren-grams. The social-networking system may identify a subset of searchqueries from the plurality of search queries as being queries forvisual-media items. The social-networking system may determine that asearch query is a query for visual-media items based on one or moren-grams of the search query being associated with visual-media content.The social-networking system may calculate, for each of the n-grams ofthe search queries of the subset of search queries, a popularity-score.The popularity-score may be based on a count of the search queries inthe subset of search queries that include the n-gram. Thesocial-networking system may determine one or more popular n-grams basedon the n-grams of the search queries of the subset of search queries.The popular n-grams may be n-grams of the search queries of the subsetof search queries having a popularity-score greater than a thresholdpopularity-score. The social-networking system may select one or more ofthe popular n-grams for training a visual-concept recognition system.Each of these popular n-grams may be selected based on whether it isassociated with one or more visual concepts. As an example and not byway of limitation, the social-networking system may forgo the selectionof a popular n-gram if it determines that the popular n-gram is alreadyassociated with one or more visual concepts.

The embodiments disclosed above are only examples, and the scope of thisdisclosure is not limited to them. Particular embodiments may includeall, some, or none of the components, elements, features, functions,operations, or steps of the embodiments disclosed above. Embodimentsaccording to the invention are in particular disclosed in the attachedclaims directed to a method, a storage medium, a system and a computerprogram product, wherein any feature mentioned in one claim category,e.g. method, can be claimed in another claim category, e.g. system, aswell. The dependencies or references back in the attached claims arechosen for formal reasons only. However any subject matter resultingfrom a deliberate reference back to any previous claims (in particularmultiple dependencies) can be claimed as well, so that any combinationof claims and the features thereof are disclosed and can be claimedregardless of the dependencies chosen in the attached claims. Thesubject-matter which can be claimed comprises not only the combinationsof features as set out in the attached claims but also any othercombination of features in the claims, wherein each feature mentioned inthe claims can be combined with any other feature or combination ofother features in the claims. Furthermore, any of the embodiments andfeatures described or depicted herein can be claimed in a separate claimand/or in any combination with any embodiment or feature described ordepicted herein or with any of the features of the attached claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example network environment associated with asocial-networking system.

FIG. 2 illustrates an example social graph.

FIGS. 3A and 3B illustrate two example representations of two differentvisual-media items.

FIG. 4 illustrates example communications associated with a visual-mediaitem.

FIG. 5 illustrates an example view of an embedding space.

FIG. 6 illustrates an example method for associating n-grams withidentified visual concepts.

FIG. 7 illustrates an example method for selecting n-grams for traininga visual-concept recognition system.

FIG. 8 illustrates an example computer system.

DESCRIPTION OF EXAMPLE EMBODIMENTS

System Overview

FIG. 1 illustrates an example network environment 100 associated with asocial-networking system. Network environment 100 includes a clientsystem 130, a social-networking system 160, and a third-party system 170connected to each other by a network 110. Although FIG. 1 illustrates aparticular arrangement of a client system 130, a social-networkingsystem 160, a third-party system 170, and a network 110, this disclosurecontemplates any suitable arrangement of a client system 130, asocial-networking system 160, a third-party system 170, and a network110. As an example and not by way of limitation, two or more of a clientsystem 130, a social-networking system 160, and a third-party system 170may be connected to each other directly, bypassing a network 110. Asanother example, two or more of a client system 130, a social-networkingsystem 160, and a third-party system 170 may be physically or logicallyco-located with each other in whole or in part. Moreover, although FIG.1 illustrates a particular number of client systems 130,social-networking systems 160, third-party systems 170, and networks110, this disclosure contemplates any suitable number of client systems130, social-networking systems 160, third-party systems 170, andnetworks 110. As an example and not by way of limitation, networkenvironment 100 may include multiple client systems 130,social-networking systems 160, third-party systems 170, and networks110.

This disclosure contemplates any suitable network 110. As an example andnot by way of limitation, one or more portions of a network 110 mayinclude an ad hoc network, an intranet, an extranet, a virtual privatenetwork (VPN), a local area network (LAN), a wireless LAN (WLAN), a widearea network (WAN), a wireless WAN (WWAN), a metropolitan area network(MAN), a portion of the Internet, a portion of the Public SwitchedTelephone Network (PSTN), a cellular telephone network, or a combinationof two or more of these. A network 110 may include one or more networks110.

Links 150 may connect a client system 130, a social-networking system160, and a third-party system 170 to a communication network 110 or toeach other. This disclosure contemplates any suitable links 150. Inparticular embodiments, one or more links 150 include one or morewireline (such as for example Digital Subscriber Line (DSL) or Data OverCable Service Interface Specification (DOCSIS)), wireless (such as forexample Wi-Fi or Worldwide Interoperability for Microwave Access(WiMAX)), or optical (such as for example Synchronous Optical Network(SONET) or Synchronous Digital Hierarchy (SDH)) links. In particularembodiments, one or more links 150 each include an ad hoc network, anintranet, an extranet, a VPN, a LAN, a WLAN, a WAN, a WWAN, a MAN, aportion of the Internet, a portion of the PSTN, a cellulartechnology-based network, a satellite communications technology-basednetwork, another link 150, or a combination of two or more such links150. Links 150 need not necessarily be the same throughout a networkenvironment 100. One or more first links 150 may differ in one or morerespects from one or more second links 150.

In particular embodiments, a client system 130 may be an electronicdevice including hardware, software, or embedded logic components or acombination of two or more such components and capable of carrying outthe appropriate functionalities implemented or supported by a clientsystem 130. As an example and not by way of limitation, a client system130 may include a computer system such as a desktop computer, notebookor laptop computer, netbook, a tablet computer, e-book reader, GPSdevice, camera, personal digital assistant (PDA), handheld electronicdevice, cellular telephone, smartphone, other suitable electronicdevice, or any suitable combination thereof. This disclosurecontemplates any suitable client systems 130. A client system 130 mayenable a network user at a client system 130 to access a network 110. Aclient system 130 may enable its user to communicate with other users atother client systems 130.

In particular embodiments, a client system 130 may include a web browser132, such as MICROSOFT INTERNET EXPLORER, GOOGLE CHROME or MOZILLAFIREFOX, and may have one or more add-ons, plug-ins, or otherextensions, such as TOOLBAR or YAHOO TOOLBAR. A user at a client system130 may enter a Uniform Resource Locator (URL) or other addressdirecting a web browser 132 to a particular server (such as server 162,or a server associated with a third-party system 170), and the webbrowser 132 may generate a Hyper Text Transfer Protocol (HTTP) requestand communicate the HTTP request to server. The server may accept theHTTP request and communicate to a client system 130 one or more HyperText Markup Language (HTML) files responsive to the HTTP request. Theclient system 130 may render a web interface (e.g. a webpage) based onthe HTML files from the server for presentation to the user. Thisdisclosure contemplates any suitable source files. As an example and notby way of limitation, a web interface may be rendered from HTML files,Extensible Hyper Text Markup Language (XHTML) files, or ExtensibleMarkup Language (XML) files, according to particular needs. Suchinterfaces may also execute scripts such as, for example and withoutlimitation, those written in JAVASCRIPT, JAVA, MICROSOFT SILVERLIGHT,combinations of markup language and scripts such as AJAX (AsynchronousJAVASCRIPT and XML), and the like. Herein, reference to a web interfaceencompasses one or more corresponding source files (which a browser mayuse to render the web interface) and vice versa, where appropriate.

In particular embodiments, the social-networking system 160 may be anetwork-addressable computing system that can host an online socialnetwork. The social-networking system 160 may generate, store, receive,and send social-networking data, such as, for example, user-profiledata, concept-profile data, social-graph information, or other suitabledata related to the online social network. The social-networking system160 may be accessed by the other components of network environment 100either directly or via a network 110. As an example and not by way oflimitation, a client system 130 may access the social-networking system160 using a web browser 132, or a native application associated with thesocial-networking system 160 (e.g., a mobile social-networkingapplication, a messaging application, another suitable application, orany combination thereof) either directly or via a network 110. Inparticular embodiments, the social-networking system 160 may include oneor more servers 162. Each server 162 may be a unitary server or adistributed server spanning multiple computers or multiple datacenters.Servers 162 may be of various types, such as, for example and withoutlimitation, web server, news server, mail server, message server,advertising server, file server, application server, exchange server,database server, proxy server, another server suitable for performingfunctions or processes described herein, or any combination thereof. Inparticular embodiments, each server 162 may include hardware, software,or embedded logic components or a combination of two or more suchcomponents for carrying out the appropriate functionalities implementedor supported by server 162. In particular embodiments, thesocial-networking system 160 may include one or more data stores 164.Data stores 164 may be used to store various types of information. Inparticular embodiments, the information stored in data stores 164 may beorganized according to specific data structures. In particularembodiments, each data store 164 may be a relational, columnar,correlation, or other suitable database. Although this disclosuredescribes or illustrates particular types of databases, this disclosurecontemplates any suitable types of databases. Particular embodiments mayprovide interfaces that enable a client system 130, a social-networkingsystem 160, or a third-party system 170 to manage, retrieve, modify,add, or delete, the information stored in data store 164.

In particular embodiments, the social-networking system 160 may storeone or more social graphs in one or more data stores 164. In particularembodiments, a social graph may include multiple nodes—which may includemultiple user nodes (each corresponding to a particular user) ormultiple concept nodes (each corresponding to a particular concept)—andmultiple edges connecting the nodes. The social-networking system 160may provide users of the online social network the ability tocommunicate and interact with other users. In particular embodiments,users may join the online social network via the social-networkingsystem 160 and then add connections (e.g., relationships) to a number ofother users of the social-networking system 160 whom they want to beconnected to. Herein, the term “friend” may refer to any other user ofthe social-networking system 160 with whom a user has formed aconnection, association, or relationship via the social-networkingsystem 160.

In particular embodiments, the social-networking system 160 may provideusers with the ability to take actions on various types of items orobjects, supported by the social-networking system 160. As an exampleand not by way of limitation, the items and objects may include groupsor social networks to which users of the social-networking system 160may belong, events or calendar entries in which a user might beinterested, computer-based applications that a user may use,transactions that allow users to buy or sell items via the service,interactions with advertisements that a user may perform, or othersuitable items or objects. A user may interact with anything that iscapable of being represented in the social-networking system 160 or byan external system of a third-party system 170, which is separate fromthe social-networking system 160 and coupled to the social-networkingsystem 160 via a network 110.

In particular embodiments, the social-networking system 160 may becapable of linking a variety of entities. As an example and not by wayof limitation, the social-networking system 160 may enable users tointeract with each other as well as receive content from third-partysystems 170 or other entities, or to allow users to interact with theseentities through an application programming interfaces (API) or othercommunication channels.

In particular embodiments, a third-party system 170 may include one ormore types of servers, one or more data stores, one or more interfaces,including but not limited to APIs, one or more web services, one or morecontent sources, one or more networks, or any other suitable components,e.g., that servers may communicate with. A third-party system 170 may beoperated by a different entity from an entity operating thesocial-networking system 160. In particular embodiments, however, thesocial-networking system 160 and third-party systems 170 may operate inconjunction with each other to provide social-networking services tousers of the social-networking system 160 or third-party systems 170. Inthis sense, the social-networking system 160 may provide a platform, orbackbone, which other systems, such as third-party systems 170, may useto provide social-networking services and functionality to users acrossthe Internet.

In particular embodiments, a third-party system 170 may include athird-party content object provider. A third-party content objectprovider may include one or more sources of content objects, which maybe communicated to a client system 130. As an example and not by way oflimitation, content objects may include information regarding things oractivities of interest to the user, such as, for example, movie showtimes, movie reviews, restaurant reviews, restaurant menus, productinformation and reviews, or other suitable information. As anotherexample and not by way of limitation, content objects may includeincentive content objects, such as coupons, discount tickets, giftcertificates, or other suitable incentive objects.

In particular embodiments, the social-networking system 160 alsoincludes user-generated content objects, which may enhance a user'sinteractions with the social-networking system 160. User-generatedcontent may include anything a user can add, upload, send, or “post” tothe social-networking system 160. As an example and not by way oflimitation, a user communicates posts to the social-networking system160 from a client system 130. Posts may include data such as statusupdates or other textual data, location information, photos, videos,links, music or other similar data or media. Content may also be addedto the social-networking system 160 by a third-party through a“communication channel,” such as a newsfeed or stream.

In particular embodiments, the social-networking system 160 may includea variety of servers, sub-systems, programs, modules, logs, and datastores. In particular embodiments, the social-networking system 160 mayinclude one or more of the following: a web server, action logger,API-request server, relevance-and-ranking engine, content-objectclassifier, notification controller, action log,third-party-content-object-exposure log, inference module,authorization/privacy server, search module, advertisement-targetingmodule, user-interface module, user-profile store, connection store,third-party content store, or location store. The social-networkingsystem 160 may also include suitable components such as networkinterfaces, security mechanisms, load balancers, failover servers,management-and-network-operations consoles, other suitable components,or any suitable combination thereof. In particular embodiments, thesocial-networking system 160 may include one or more user-profile storesfor storing user profiles. A user profile may include, for example,biographic information, demographic information, behavioral information,social information, or other types of descriptive information, such aswork experience, educational history, hobbies or preferences, interests,affinities, or location. Interest information may include interestsrelated to one or more categories. Categories may be general orspecific. As an example and not by way of limitation, if a user “likes”an article about a brand of shoes the category may be the brand, or thegeneral category of “shoes” or “clothing.” A connection store may beused for storing connection information about users. The connectioninformation may indicate users who have similar or common workexperience, group memberships, hobbies, educational history, or are inany way related or share common attributes. The connection informationmay also include user-defined connections between different users andcontent (both internal and external). A web server may be used forlinking the social-networking system 160 to one or more client systems130 or one or more third-party systems 170 via a network 110. The webserver may include a mail server or other messaging functionality forreceiving and routing messages between the social-networking system 160and one or more client systems 130. An API-request server may allow athird-party system 170 to access information from the social-networkingsystem 160 by calling one or more APIs. An action logger may be used toreceive communications from a web server about a user's actions on oroff the social-networking system 160. In conjunction with the actionlog, a third-party-content-object log may be maintained of userexposures to third-party-content objects. A notification controller mayprovide information regarding content objects to a client system 130.Information may be pushed to a client system 130 as notifications, orinformation may be pulled from a client system 130 responsive to arequest received from a client system 130. Authorization servers may beused to enforce one or more privacy settings of the users of thesocial-networking system 160. A privacy setting of a user determines howparticular information associated with a user can be shared. Theauthorization server may allow users to opt in to or opt out of havingtheir actions logged by the social-networking system 160 or shared withother systems (e.g., a third-party system 170), such as, for example, bysetting appropriate privacy settings. Third-party-content-object storesmay be used to store content objects received from third parties, suchas a third-party system 170. Location stores may be used for storinglocation information received from client systems 130 associated withusers. Advertisement-pricing modules may combine social information, thecurrent time, location information, or other suitable information toprovide relevant advertisements, in the form of notifications, to auser.

Social Graphs

FIG. 2 illustrates an example social graph 200. In particularembodiments, the social-networking system 160 may store one or moresocial graphs 200 in one or more data stores. In particular embodiments,the social graph 200 may include multiple nodes—which may includemultiple user nodes 202 or multiple concept nodes 204—and multiple edges206 connecting the nodes. The example social graph 200 illustrated inFIG. 2 is shown, for didactic purposes, in a two-dimensional visual maprepresentation. In particular embodiments, a social-networking system160, a client system 130, or a third-party system 170 may access thesocial graph 200 and related social-graph information for suitableapplications. The nodes and edges of the social graph 200 may be storedas data objects, for example, in a data store (such as a social-graphdatabase). Such a data store may include one or more searchable orqueryable indexes of nodes or edges of the social graph 200.

In particular embodiments, a user node 202 may correspond to a user ofthe social-networking system 160. As an example and not by way oflimitation, a user may be an individual (human user), an entity (e.g.,an enterprise, business, or third-party application), or a group (e.g.,of individuals or entities) that interacts or communicates with or overthe social-networking system 160. In particular embodiments, when a userregisters for an account with the social-networking system 160, thesocial-networking system 160 may create a user node 202 corresponding tothe user, and store the user node 202 in one or more data stores. Usersand user nodes 202 described herein may, where appropriate, refer toregistered users and user nodes 202 associated with registered users. Inaddition or as an alternative, users and user nodes 202 described hereinmay, where appropriate, refer to users that have not registered with thesocial-networking system 160. In particular embodiments, a user node 202may be associated with information provided by a user or informationgathered by various systems, including the social-networking system 160.As an example and not by way of limitation, a user may provide his orher name, profile picture, contact information, birth date, sex, maritalstatus, family status, employment, education background, preferences,interests, or other demographic information. In particular embodiments,a user node 202 may be associated with one or more data objectscorresponding to information associated with a user. In particularembodiments, a user node 202 may correspond to one or more webinterfaces.

In particular embodiments, a concept node 204 may correspond to asocial-graph concept. As an example and not by way of limitation, asocial-graph concept may correspond to a place (such as, for example, amovie theater, restaurant, landmark, or city); a website (such as, forexample, a website associated with the social-networking system 160 or athird-party website associated with a web-application server); an entity(such as, for example, a person, business, group, sports team, orcelebrity); a resource (such as, for example, an audio file, video file,digital photo, text file, structured document, or application) which maybe located within the social-networking system 160 or on an externalserver, such as a web-application server; real or intellectual property(such as, for example, a sculpture, painting, movie, game, song, idea,photograph, or written work); a game; an activity; an idea or theory;another suitable social-graph concept; or two or more such social-graphconcepts. A concept node 204 may be associated with information of asocial-graph concept provided by a user or information gathered byvarious systems, including the social-networking system 160. As anexample and not by way of limitation, information of a social-graphconcept may include a name or a title; one or more images (e.g., animage of the cover page of a book); a location (e.g., an address or ageographical location); a website (which may be associated with a URL);contact information (e.g., a phone number or an email address); othersuitable social-graph concept information; or any suitable combinationof such information. In particular embodiments, a concept node 204 maybe associated with one or more data objects corresponding to informationassociated with concept node 204. In particular embodiments, a conceptnode 204 may correspond to one or more web interfaces.

In particular embodiments, a node in the social graph 200 may representor be represented by a web interface (which may be referred to as a“profile interface”). Profile interfaces may be hosted by or accessibleto the social-networking system 160. Profile interfaces may also behosted on third-party websites associated with a third-party server 170.As an example and not by way of limitation, a profile interfacecorresponding to a particular external web interface may be theparticular external web interface and the profile interface maycorrespond to a particular concept node 204. Profile interfaces may beviewable by all or a selected subset of other users. As an example andnot by way of limitation, a user node 202 may have a correspondinguser-profile interface in which the corresponding user may add content,make declarations, or otherwise express himself or herself. As anotherexample and not by way of limitation, a concept node 204 may have acorresponding concept-profile interface in which one or more users mayadd content, make declarations, or express themselves, particularly inrelation to the social-graph concept corresponding to concept node 204.

In particular embodiments, a concept node 204 may represent athird-party web interface or resource hosted by a third-party system170. The third-party web interface or resource may include, among otherelements, content, a selectable or other icon, or other inter-actableobject (which may be implemented, for example, in JavaScript, AJAX, orPHP codes) representing an action or activity. As an example and not byway of limitation, a third-party web interface may include a selectableicon such as “like,” “check-in,” “eat,” “recommend,” or another suitableaction or activity. A user viewing the third-party web interface mayperform an action by selecting one of the icons (e.g., “check-in”),causing a client system 130 to send to the social-networking system 160a message indicating the user's action. In response to the message, thesocial-networking system 160 may create an edge (e.g., a check-in-typeedge) between a user node 202 corresponding to the user and a conceptnode 204 corresponding to the third-party web interface or resource andstore edge 206 in one or more data stores.

In particular embodiments, a pair of nodes in the social graph 200 maybe connected to each other by one or more edges 206. An edge 206connecting a pair of nodes may represent a relationship between the pairof nodes. In particular embodiments, an edge 206 may include orrepresent one or more data objects or attributes corresponding to therelationship between a pair of nodes. As an example and not by way oflimitation, a first user may indicate that a second user is a “friend”of the first user. In response to this indication, the social-networkingsystem 160 may send a “friend request” to the second user. If the seconduser confirms the “friend request,” the social-networking system 160 maycreate an edge 206 connecting the first user's user node 202 to thesecond user's user node 202 in the social graph 200 and store edge 206as social-graph information in one or more of data stores 164. In theexample of FIG. 2, the social graph 200 includes an edge 206 indicatinga friend relation between user nodes 202 of user “A” and user “B” and anedge indicating a friend relation between user nodes 202 of user “C” anduser “B.” Although this disclosure describes or illustrates particularedges 206 with particular attributes connecting particular user nodes202, this disclosure contemplates any suitable edges 206 with anysuitable attributes connecting user nodes 202. As an example and not byway of limitation, an edge 206 may represent a friendship, familyrelationship, business or employment relationship, fan relationship(including, e.g., liking, etc.), follower relationship, visitorrelationship (including, e.g., accessing, viewing, checking-in, sharing,etc.), subscriber relationship, superior/subordinate relationship,reciprocal relationship, non-reciprocal relationship, another suitabletype of relationship, or two or more such relationships. Moreover,although this disclosure generally describes nodes as being connected,this disclosure also describes users or social-graph concepts as beingconnected. Herein, references to users or social-graph concepts beingconnected may, where appropriate, refer to the nodes corresponding tothose users or social-graph concepts being connected in the social graph200 by one or more edges 206.

In particular embodiments, an edge 206 between a user node 202 and aconcept node 204 may represent a particular action or activity performedby a user associated with user node 202 toward a social-graph conceptassociated with a concept node 204. As an example and not by way oflimitation, as illustrated in FIG. 2, a user may “like,” “attended,”“played,” “listened,” “cooked,” “worked at,” or “watched” a social-graphconcept, each of which may correspond to an edge type or subtype. Aconcept-profile interface corresponding to a concept node 204 mayinclude, for example, a selectable “check in” icon (such as, forexample, a clickable “check in” icon) or a selectable “add to favorites”icon. Similarly, after a user clicks these icons, the social-networkingsystem 160 may create a “favorite” edge or a “check in” edge in responseto a user's action corresponding to a respective action. As anotherexample and not by way of limitation, a user (user “C”) may listen to aparticular song (“Imagine”) using a particular application (SPOTIFY,which is an online music application). In this case, thesocial-networking system 160 may create a “listened” edge 206 and a“used” edge (as illustrated in FIG. 2) between user nodes 202corresponding to the user and concept nodes 204 corresponding to thesong and application to indicate that the user listened to the song andused the application. Moreover, the social-networking system 160 maycreate a “played” edge 206 (as illustrated in FIG. 2) between conceptnodes 204 corresponding to the song and the application to indicate thatthe particular song was played by the particular application. In thiscase, “played” edge 206 corresponds to an action performed by anexternal application (SPOTIFY) on an external audio file (the song“Imagine”). Although this disclosure describes particular edges 206 withparticular attributes connecting user nodes 202 and concept nodes 204,this disclosure contemplates any suitable edges 206 with any suitableattributes connecting user nodes 202 and concept nodes 204. Moreover,although this disclosure describes edges between a user node 202 and aconcept node 204 representing a single relationship, this disclosurecontemplates edges between a user node 202 and a concept node 204representing one or more relationships. As an example and not by way oflimitation, an edge 206 may represent both that a user likes and hasused at a particular social-graph concept. Alternatively, another edge206 may represent each type of relationship (or multiples of a singlerelationship) between a user node 202 and a concept node 204 (asillustrated in FIG. 2 between user node 202 for user “E” and conceptnode 204 for “SPOTIFY”).

In particular embodiments, the social-networking system 160 may createan edge 206 between a user node 202 and a concept node 204 in the socialgraph 200. As an example and not by way of limitation, a user viewing aconcept-profile interface (such as, for example, by using a web browseror a special-purpose application hosted by the user's client system 130)may indicate that he or she likes the social-graph concept representedby the concept node 204 by clicking or selecting a “Like” icon, whichmay cause the user's client system 130 to send to the social-networkingsystem 160 a message indicating the user's liking of the social-graphconcept associated with the concept-profile interface. In response tothe message, the social-networking system 160 may create an edge 206between user node 202 associated with the user and concept node 204, asillustrated by “like” edge 206 between the user and concept node 204. Inparticular embodiments, the social-networking system 160 may store anedge 206 in one or more data stores. In particular embodiments, an edge206 may be automatically formed by the social-networking system 160 inresponse to a particular user action. As an example and not by way oflimitation, if a first user uploads a picture, watches a movie, orlistens to a song, an edge 206 may be formed between user node 202corresponding to the first user and concept nodes 204 corresponding tothose social-graph concepts. Although this disclosure describes formingparticular edges 206 in particular manners, this disclosure contemplatesforming any suitable edges 206 in any suitable manner. Although thisdisclosure focuses on concept nodes corresponding to social-graphconcepts, it also contemplates concept nodes corresponding to visualconcepts.

Search Queries on Online Social Networks

In particular embodiments, a user may submit a query to thesocial-networking system 160 by, for example, selecting a query input orinputting text into query field. A user of an online social network maysearch for information relating to a specific subject matter (e.g.,users, social-graph concepts, external content or resource) by providinga short phrase describing the subject matter, often referred to as a“search query,” to a search engine. The query may be an unstructuredtext query and may comprise one or more text strings (which may includeone or more n-grams). In general, a user may input any character stringinto a query field to search for content on the social-networking system160 that matches the text query. The social-networking system 160 maythen search a data store 164 (or, in particular, a social-graphdatabase) to identify content matching the query. The search engine mayconduct a search based on the query phrase using various searchalgorithms and generate search results that identify resources orcontent (e.g., user-profile interfaces, content-profile interfaces, orexternal resources) that are most likely to be related to the searchquery. To conduct a search, a user may input or send a search query tothe search engine. In response, the search engine may identify one ormore resources that are likely to be related to the search query, eachof which may individually be referred to as a “search result,” orcollectively be referred to as the “search results” corresponding to thesearch query. The identified content may include, for example,social-graph elements (i.e., user nodes 202, concept nodes 204, edges206), profile interfaces, external web interfaces, or any combinationthereof. The social-networking system 160 may then generate asearch-results interface with search results corresponding to theidentified content and send the search-results interface to the user.The search results may be presented to the user, often in the form of alist of links on the search-results interface, each link beingassociated with a different interface that contains some of theidentified resources or content. In particular embodiments, each link inthe search results may be in the form of a Uniform Resource Locator(URL) that specifies where the corresponding interface is located andthe mechanism for retrieving it. The social-networking system 160 maythen send the search-results interface to the web browser 132 on theuser's client system 130. The user may then click on the URL links orotherwise select the content from the search-results interface to accessthe content from the social-networking system 160 or from an externalsystem (such as, for example, a third-party system 170), as appropriate.The resources may be ranked and presented to the user according to theirrelative degrees of relevance to the search query. The search resultsmay also be ranked and presented to the user according to their relativedegree of relevance to the user. In other words, the search results maybe personalized for the querying user based on, for example,social-graph information, user information, search or browsing historyof the user, or other suitable information related to the user. Inparticular embodiments, ranking of the resources may be determined by aranking algorithm implemented by the search engine. As an example andnot by way of limitation, resources that are more relevant to the searchquery or to the user may be ranked higher than the resources that areless relevant to the search query or the user. In particularembodiments, the search engine may limit its search to resources andcontent on the online social network. However, in particularembodiments, the search engine may also search for resources or contentson other sources, such as a third-party system 170, the internet orWorld Wide Web, or other suitable sources. Although this disclosuredescribes querying the social-networking system 160 in a particularmanner, this disclosure contemplates querying the social-networkingsystem 160 in any suitable manner.

Typeahead Processes and Queries

In particular embodiments, one or more client-side and/or backend(server-side) processes may implement and utilize a “typeahead” featurethat may automatically attempt to match social-graph elements (e.g.,user nodes 202, concept nodes 204, or edges 206) to informationcurrently being entered by a user in an input form rendered inconjunction with a requested interface (such as, for example, auser-profile interface, a concept-profile interface, a search-resultsinterface, a user interface/view state of a native applicationassociated with the online social network, or another suitable interfaceof the online social network), which may be hosted by or accessible inthe social-networking system 160. In particular embodiments, as a useris entering text to make a declaration, the typeahead feature mayattempt to match the string of textual characters being entered in thedeclaration to strings of characters (e.g., names, descriptions)corresponding to users, social-graph concepts, or edges and theircorresponding elements in the social graph 200. In particularembodiments, when a match is found, the typeahead feature mayautomatically populate the form with a reference to the social-graphelement (such as, for example, the node name/type, node ID, edgename/type, edge ID, or another suitable reference or identifier) of theexisting social-graph element. In particular embodiments, as the userenters characters into a form box, the typeahead process may read thestring of entered textual characters. As each keystroke is made, thefrontend-typeahead process may send the entered character string as arequest (or call) to the backend-typeahead process executing within thesocial-networking system 160. In particular embodiments, the typeaheadprocess may use one or more matching algorithms to attempt to identifymatching social-graph elements. In particular embodiments, when a matchor matches are found, the typeahead process may send a response to theuser's client system 130 that may include, for example, the names (namestrings) or descriptions of the matching social-graph elements as wellas, potentially, other metadata associated with the matchingsocial-graph elements. As an example and not by way of limitation, if auser enters the characters “pok” into a query field, the typeaheadprocess may display a drop-down menu that displays names of matchingexisting profile interfaces and respective user nodes 202 or conceptnodes 204, such as a profile interface named or devoted to “poker” or“pokemon,” which the user can then click on or otherwise select therebyconfirming the desire to declare the matched user or social-graphconcept name corresponding to the selected node.

More information on typeahead processes may be found in U.S. patentapplication Ser. No. 12/763,162, filed 19 Apr. 2010, and U.S. patentapplication Ser. No. 13/556,072, filed 23 Jul. 2012, each of which isincorporated by reference.

In particular embodiments, the typeahead processes described herein maybe applied to search queries entered by a user. As an example and not byway of limitation, as a user enters text characters into a query field,a typeahead process may attempt to identify one or more user nodes 202,concept nodes 204, or edges 206 that match the string of charactersentered into the query field as the user is entering the characters. Asthe typeahead process receives requests or calls including a string orn-gram from the text query, the typeahead process may perform or causeto be performed a search to identify existing social-graph elements(i.e., user nodes 202, concept nodes 204, edges 206) having respectivenames, types, categories, or other identifiers matching the enteredtext. The typeahead process may use one or more matching algorithms toattempt to identify matching nodes or edges. When a match or matches arefound, the typeahead process may send a response to the user's clientsystem 130 that may include, for example, the names (name strings) ofthe matching nodes as well as, potentially, other metadata associatedwith the matching nodes. The typeahead process may then display adrop-down menu that displays names of matching existing profileinterfaces and respective user nodes 202 or concept nodes 204, anddisplays names of matching edges 206 that may connect to the matchinguser nodes 202 or concept nodes 204, which the user can then click on orotherwise select thereby confirming the desire to search for the matcheduser or social-graph concept name corresponding to the selected node, orto search for users or social-graph concepts connected to the matchedusers or social-graph concepts by the matching edges. Alternatively, thetypeahead process may simply auto-populate the form with the name orother identifier of the top-ranked match rather than display a drop-downmenu. The user may then confirm the auto-populated declaration simply bykeying “enter” on a keyboard or by clicking on the auto-populateddeclaration. Upon user confirmation of the matching nodes and edges, thetypeahead process may send a request that informs the social-networkingsystem 160 of the user's confirmation of a query containing the matchingsocial-graph elements. In response to the request sent, thesocial-networking system 160 may automatically (or alternately based onan instruction in the request) call or otherwise search a social-graphdatabase for the matching social-graph elements, or for social-graphelements connected to the matching social-graph elements as appropriate.Although this disclosure describes applying the typeahead processes tosearch queries in a particular manner, this disclosure contemplatesapplying the typeahead processes to search queries in any suitablemanner.

In connection with search queries and search results, particularembodiments may utilize one or more systems, components, elements,functions, methods, operations, or steps disclosed in U.S. patentapplication Ser. No. 11/503,093, filed 11 Aug. 2006, U.S. patentapplication Ser. No. 12/977,027, filed 22 Dec. 2010, and U.S. patentapplication Ser. No. 12/978,265, filed 23 Dec. 2010, each of which isincorporated by reference.

Structured Search Queries

In particular embodiments, in response to a text query received from afirst user (i.e., the querying user), the social-networking system 160may parse the text query and identify portions of the text query thatcorrespond to particular social-graph elements. However, in some cases aquery may include one or more terms that are ambiguous, where anambiguous term is a term that may possibly correspond to multiplesocial-graph elements. To parse the ambiguous term, thesocial-networking system 160 may access a social graph 200 and thenparse the text query to identify the social-graph elements thatcorresponded to ambiguous n-grams from the text query. Thesocial-networking system 160 may then generate a set of structuredqueries, where each structured query corresponds to one of the possiblematching social-graph elements. These structured queries may be based onstrings generated by a grammar model, such that they are rendered in anatural-language syntax with references to the relevant social-graphelements. As an example and not by way of limitation, in response to thetext query, “show me friends of my girlfriend,” the social-networkingsystem 160 may generate a structured query “Friends of Stephanie,” where“Friends” and “Stephanie” in the structured query are referencescorresponding to particular social-graph elements. The reference to“Stephanie” would correspond to a particular user node 202 (where thesocial-networking system 160 has parsed the n-gram “my girlfriend” tocorrespond with a user node 202 for the user “Stephanie”), while thereference to “Friends” would correspond to friend-type edges 206connecting that user node 202 to other user nodes 202 (i.e., edges 206connecting to “Stephanie's” first-degree friends). When executing thisstructured query, the social-networking system 160 may identify one ormore user nodes 202 connected by friend-type edges 206 to the user node202 corresponding to “Stephanie”. As another example and not by way oflimitation, in response to the text query, “friends who work atfacebook,” the social-networking system 160 may generate a structuredquery “My friends who work at Facebook,” where “my friends,” “work at,”and “Facebook” in the structured query are references corresponding toparticular social-graph elements as described previously (i.e., afriend-type edge 206, a work-at-type edge 206, and concept node 204corresponding to the company “Facebook”). By providing suggestedstructured queries in response to a user's text query, thesocial-networking system 160 may provide a powerful way for users of theonline social network to search for elements represented in the socialgraph 200 based on their social-graph attributes and their relation tovarious social-graph elements. Structured queries may allow a queryinguser to search for content that is connected to particular users orconcepts in the social graph 200 by particular edge-types. Thestructured queries may be sent to the first user and displayed in adrop-down menu (via, for example, a client-side typeahead process),where the first user can then select an appropriate query to search forthe desired content. Some of the advantages of using the structuredqueries described herein include finding users of the online socialnetwork based upon limited information, bringing together virtualindexes of content from the online social network based on the relationof that content to various social-graph elements, or finding contentrelated to you and/or your friends. Although this disclosure describesgenerating particular structured queries in a particular manner, thisdisclosure contemplates generating any suitable structured queries inany suitable manner.

More information on element detection and parsing queries may be foundin U.S. patent application Ser. No. 13/556,072, filed 23 Jul. 2012, U.S.patent application Ser. No. 13/731,866, filed 31 Dec. 2012, and U.S.patent application Ser. No. 13/732,101, filed 31 Dec. 2012, each ofwhich is incorporated by reference. More information on structuredsearch queries and grammar models may be found in U.S. patentapplication Ser. No. 13/556,072, filed 23 Jul. 2012, U.S. patentapplication Ser. No. 13/674,695, filed 12 Nov. 2012, and U.S. patentapplication Ser. No. 13/731,866, filed 31 Dec. 2012, each of which isincorporated by reference.

Generating Keywords and Keyword Queries

In particular embodiments, the social-networking system 160 may providecustomized keyword completion suggestions to a querying user as the useris inputting a text string into a query field. Keyword completionsuggestions may be provided to the user in a non-structured format. Inorder to generate a keyword completion suggestion, the social-networkingsystem 160 may access multiple sources within the social-networkingsystem 160 to generate keyword completion suggestions, score the keywordcompletion suggestions from the multiple sources, and then return thekeyword completion suggestions to the user. As an example and not by wayof limitation, if a user types the query “friends stan,” then thesocial-networking system 160 may suggest, for example, “friendsstanford,” “friends stanford university,” “friends stanley,” “friendsstanley cooper,” “friends stanley kubrick,” “friends stanley cup,” and“friends stanlonski.” In this example, the social-networking system 160is suggesting the keywords which are modifications of the ambiguousn-gram “stan,” where the suggestions may be generated from a variety ofkeyword generators. The social-networking system 160 may have selectedthe keyword completion suggestions because the user is connected in someway to the suggestions. As an example and not by way of limitation, thequerying user may be connected within the social graph 200 to theconcept node 204 corresponding to Stanford University, for example bylike- or attended-type edges 206. The querying user may also have afriend named Stanley Cooper. Although this disclosure describesgenerating keyword completion suggestions in a particular manner, thisdisclosure contemplates generating keyword completion suggestions in anysuitable manner.

More information on keyword queries may be found in U.S. patentapplication Ser. No. 14/244,748, filed 3 Apr. 2014, U.S. patentapplication Ser. No. 14/470,607, filed 27 Aug. 2014, and U.S. patentapplication Ser. No. 14/561,418, filed 5 Dec. 2014, each of which isincorporated by reference.

Training Image-Recognition Systems Using a Joint Embedding Model

When users search for visual-media items, they often attempt to searchfor visual concepts (i.e., distinct concepts that may be visuallyperceived and recognized by human users in images, such as objects orpersons) within the visual-media items by constructing search queriesthat describe the visual concepts. Constructing search queries in thismanner may be intuitive to users, but may be difficult for a computingsystem to resolve. One problem that arises with such search queries isthe identifying of visual concepts in visual-media items, which can beparticularly difficult without human input. Classifying them may be evenmore difficult, such that identifying visual-media items responsive to asearch query that attempts to describe visual concepts in visual-mediaitems presents a significant challenge. Some current methods simply usea limited—and often noisy—pool of text sources (e.g., text from thetitle, description, comments, reshares, other linked content, etc.) thatmay be associated with visual-media items but may do a poor job ofdescribing the important visual concepts within visual-media items—i.e.,the visual concepts that users may actually search for when attemptingto access visual-media items. Additionally, the text that usersassociate with the visual concepts they intend to search for, andconsequently the text that they use in constructing the correspondingsearch queries, may be difficult to determine. As an example and not byway of limitation, users may construct search queries with slang termsthat are intended to refer to visual concepts, and these slang terms maybe constantly evolving such that a fixed set of keywords for visualconcepts may not be ideal in handling search queries for these visualconcepts. The methods described herein attempt to solve these technicalchallenges associated with searching for visual-media items by using animage-recognition process to segment images of visual-media items andidentify visual concepts therein and by then tying those visual conceptsto text supplied by user communications, where the text is determined tobe likely to describe those visual concepts. The described jointembedding model may be advantageous in that it allows thesocial-networking system 160 to leverage what is effectivelycrowdsourced information from text associated with visual-media items(e.g., from communications, metadata, etc.) to determine associationsbetween n-grams and visual-media items, and ultimately between n-gramsand visual concepts. In this way, the social-networking system 160 maybe able to describe visual concepts based on the n-grams that areassociated with the visual concepts. This method of describing visualconcepts may be more efficient than other solutions in that it uses alarge amount of existing information (e.g., information fromcommunications on the social-networking system 160 or other informationsourced from a large number of users) to train a visual-conceptrecognition system and describe concepts appearing in visual-mediaitems, rather than resorting to more processor- and labor-intensiveefforts that may be required in training a system to classify conceptsin visual-media items. The technical benefit of this training may be theability to index visual concepts with n-grams that users associate withthose visual concepts, and ultimately, the ability to efficiently returnhigh-quality search results to search queries directed at indexed visualconcepts. The described training process may have the ability to belanguage-agnostic, which has the technical benefit of not requiring asemantic understanding of visual concepts of visual-media items and maythereby reduce the complexities of processing such information. Thelanguage-agnostic nature may also allow for the training process tofunction seamlessly across various languages, so long as associationscan be made between n-grams and visual concepts (or visual media-items).

In particular embodiments, the social-networking system 160 may identifya shared visual concept in two or more visual-media items. Eachvisual-media item may include visual concepts in one or more of itsimages that may be identified based on visual features in the images. Ashared visual concept may be identified in two or more videos based onone or more shared visual features in the respective images of thevisual-media items. The social-networking system 160 may extract, foreach of the visual-media items, one or more n-grams from one or morecommunications associated with the visual-media item. In particularembodiments, the social-networking system 160 may generate, in ad-dimensional space, an embedding for each of the visual-media items,wherein a location of the embedding for the visual-media item is basedon the one or more visual concepts included in the visual-media item.The social-networking system 160 may generate, in the d-dimensionalspace, an embedding for each of the extracted n-grams, wherein alocation of the embedding for the n-gram is based on a frequency ofoccurrence of the n-gram in the communications associated with thevisual-media items. The social-networking system 160 may associate, withthe shared visual concept, one or more of the extracted n-grams thathave embeddings within a threshold area of the embeddings for theidentified visual-media items. Although the disclosure focuses onvisual-media items, it contemplates applying the disclosed methods toother types of media such as audio (e.g., using an audio-recognitionprocess rather than an image-recognition process). Furthermore, althoughthe disclosure focuses on extracting n-grams from communications, itcontemplates extracting n-grams or other suitable units of informationfrom other sources.

In particular embodiments, the social-networking system 160 may performan image-analysis process on visual-media items to identify one or morevisual features present in the visual-media items. A visual-media itemmay be a content item that includes one or more images (e.g., a video, aphoto, an image file such as a GIF or JPEG, an emoji, etc.), each imageincluding one or more visual features. The images may include one ormore visual features, which may be visual descriptors of the images(e.g., color, shape, regions, textures, location, motion). Eachvisual-media item may include one or more visual concepts (which maycorrespond to depictions of objects such as a face) that may beidentified based on the visual features detected in images or a sequenceof images (e.g., based on an image-segmentation algorithm thatpartitions an image into segments based on visual features).

In particular embodiments, the social-networking system 160 may performan image-analysis process on one or more visual-media items to identifyone or more visual features present in the visual-media items. Thevisual features of an image may be visual descriptors of the image. Thatis, the visual features of an image may be a qualitative description ofdistinct characteristics of the image that may be visually perceived(e.g., by a human viewing the image). As an example and not by way oflimitation, visual features may describe such information as color,shape, regions, textures, and location (e.g., of identified shapes inthe image). In particular embodiments, the visual-media item may alsoinclude visual features based on a sequence of images. As an example andnot by way of limitation, a visual-media item may include motion as avisual feature (e.g., describing what appears to be the motion of one ormore objects apparently common to a sequence of images of thevisual-media item). In particular embodiments, any suitablefeature-detection algorithms or techniques may be used to detect visualfeatures present in images of the visual-media item. As an example andnot by way of limitation, a feature-detection algorithm may identifyshapes by evaluating the pixels of an image for the presence ofimage-edges (e.g., sets of points in an image that have a stronggradient magnitude), corners (e.g., sets of points with low levels ofcurvature), blogs (relatively smooth areas), and/or ridges.

FIGS. 3A and 3B illustrate two example representations of two differentvisual-media items. Each representation may be an image of therespective visual-media item. Each visual-media item may include one ormore visual concepts that may be depicted in the images of thevisual-media item. Visual concepts may correspond to higher-levelcharacteristics of an image or a sequence of images in a visual-mediaitem that describe distinct, identifiable concepts that would berecognizable as distinct concepts to a human. As an example and not byway of limitation, visual concepts may correspond to depictions ofobjects that appear in an image (e.g., a face of a particular person, acar) or depictions of concepts expressed by a sequence of images (e.g.,a swinging pendulum in a sequence of images). The social-networkingsystem 160 may identify visual concepts by an image-segmentationalgorithm that partitions an image into one or more segments, at leastone of which may correspond to a set of pixels that corresponds to adepiction of a visual concept. The image-segmentation algorithm maypartition an image into segments by grouping sets of pixels togetherbased on visual features of the image. In doing so, theimage-segmentation algorithm may use the visual features as cues todetermine sets of pixels that may correspond to a depiction of a visualconcept. As an example and not by way of limitation, referencing FIG.3A, the image-segmentation algorithm may partition the image 310 intomultiple segments, including the segment 320 (e.g., corresponding to avisual concept that a human may recognize as a depiction of a cat) basedon factors such as colors, shapes, and textures that suggest a regionboundary defined by the segment 320. One method of partitioning an imageinto segments may involve the use of one or more deep-learning models(e.g., a convolutional neural network) that divides the image into oneor more patches and then analyzes the image on a patch-by-patch basis.As an example and not by way of limitation, each patch may be a fixedregion that is 200×200 pixels. In this example, the system may generate,in relation to a first patch, a second overlapping patch by shifting thelocation of the patch by a fixed amount of pixels (e.g., a 16-pixelshift) in any suitable direction. This may be repeated to cover thewhole image. Each patch is analyzed by determining whether or not thepatch contains one or more objects using visual features of the patch. Adeep-learning model may then determine whether each pixel in the patchis part of a central object in the patch, and whether the patch containsan object roughly centered in the patch. Additionally, a deep-learningmodel may determine if the object is fully contained in the patch and ina given scale range. After similar analyses on each patch in the image,including overlapping patches, a deep-learning model may partition theimage into segments. In particular embodiments, the social-networkingsystem 160 may then shrink the image by a factor of

$2^{\frac{1}{2}},$run the 16-pixel shifted windows of the down-sized image through theimage through the deep-learning model to obtain additional objectproposals for the image. The social-networking system 160 may thenshrink the object by another factor of

$2^{\frac{1}{2}},$to get an image that is half the size of the original image (e.g.,100×100 pixels) and may run the 16-pixel shifted windows of the100-pixel image through the deep-learning model to obtain additionalobject proposals for the image. This sliding and scaling window approachensures that the system is able to generate object proposals for objectsat different positions in the image and for objects of different sizes.In particular embodiments, the social-networking system 160 may useenough differently-located and sized patches of an image so that foreach object in the image, at least one patch is run through the systemthat fully contains the object (i.e., roughly centered and at theappropriate scale). In particular embodiments, the system may includethree convolutional neural networks. As shown in the illustratedembodiment of FIG. 5, the system may have a first, feature-extractionconvolutional neural network that may take as inputs patches of imagesand output features of the patch/image (i.e., any number of featuresdetected in the image). The feature-extraction layers may be pre-trainedto perform classification on the image. The feature-extraction model maybe fine-tuned for object proposals during training of the system. As anexample and not by way of limitation, the feature-extraction layers mayconsist of eight 3×3 convolutional layers and five 2×2 max-poolinglayers. As an example and not by way of limitation, thefeature-extraction layers may take an input image of dimension 3×h×w,and the output may be a feature map of dimensions

$512 \times \frac{h}{16} \times {\frac{w}{16}.}$More information on partitioning images into segments may be found inthe following, each of which is incorporated by reference: Pedro O.Pinheiro et al., Learning to Segment Object Candidates, 28 NeuralInformation Processing Systems, Sep. 1, 2015; and Pedro O. Pinheiro etal., Learning to Refine Object Segments, European Conference on ComputerVision, Jul. 26, 2016.

In particular embodiments, the social-networking system 160 may identifya shared visual concept in two or more visual-media items. Thesocial-networking system 160 may do so by comparing visual features ofpixels (or groups of pixels) of segments of images (which may correspondto visual concepts) of different visual-media items. Segments havinggreater than a threshold degree of similarity in their visual featuresmay be determined to correspond to a depiction of a shared visualconcept. As an example and not by way of limitation, referencing FIGS.3A and 3B, the social-networking system 160 may identify a shared visualconcept depicted in visual-media items (e.g., an image of a video, aphoto image) 310 and 330 in the segments 320 and 340. In particularembodiments, a particular visual concept may be defined by one or moreof the visual features associated with the visual concept. Thisdefinition may constantly be refining and evolving as thesocial-networking system 160 identifies more and more visual-media itemswith segments determined to correspond to the particular visual concept(e.g., by identifying visual-media items with segments having greaterthan a threshold degree of similarity). In particular embodiments, thesocial-networking system 160 may not need to have a semanticunderstanding of what any particular visual concept is. Rather, thevisual concept may be defined by its associated visual features,determined based on some or all of the visual-media items that wereidentified as having the visual concept. As an example and not by way oflimitation, referencing FIGS. 3A and 3B, the social-networking system160 may not need to understand that the visual concepts depicted bysegments 320 and 340 correspond to cats. In this example, thesocial-networking system 160 may simply recognize that both segmentshave a threshold degree of similarity in visual features (e.g., based onshape, texture, color) so as to be identified as a shared visualconcept. By not requiring a semantic understanding of visual concepts,the social-networking system 160 may conserve time and resources usingthe methods described herein. Although this disclosure describesidentifying particular visual concepts in a particular manner, itcontemplates identifying any suitable concepts in any suitable manner.

FIG. 4 illustrates example communications associated with a visual-mediaitem. In particular embodiments, the social-networking system 160 mayextract, for each of the visual-media items, one or more n-grams fromone or more communications associated with the visual-media item. Ingeneral, an n-gram may be a contiguous sequence of n items from a givensequence of text. The items may be characters, phonemes, syllables,letters, words, base pairs, prefixes, or other identifiable items fromthe sequence of text or speech. An n-gram may include one or morecharacters of text (letters, numbers, punctuation, etc.) in the contentof a post or the metadata associated with the post. In particularembodiments, each n-gram may include a character string (e.g., one ormore characters of text). In particular embodiments, an n-gram mayinclude more than one word. For purposes of this disclosure,communications may be associated with a visual-media item if it includesthe visual-media item or if it is otherwise related to a visual-mediaitem. As an example and not by way of limitation, the communications maybe communications on the online social network, such as comments, posts,or reshares, that include the visual-media item (e.g., as a contentobject within a communication). As an example and not by way oflimitation, the communications may include a reference to thevisual-media item. In this example, the reference may be a directreference (e.g., a link) to the visual-media item or may be an implicitreference to the visual-media item (e.g., a comment to a post thatincludes a link to a visual-media item). In particular embodiments, notall n-grams of a communication may be extracted. The social-networkingsystem 160 may parse the text of the communication to identify one ormore n-grams that may be extracted by the social-networking system 160.In particular embodiments, the social-networking system 160 may make useof a Natural Language Processing (NLP) analysis in parsing through thetext of the communication to identify the n-grams. As an example and notby way of limitation, referencing FIG. 4, the social-networking system160 may parse some or all of the text of the post 410 (e.g., “this is avery cool cat video”) to identify n-grams that may be extracted. Thesocial-networking system 160 may identify, among others, the followingn-grams: cat; video; cat video. The social-networking system 160 mayalso parse through metadata associated with a visual-media item. As anexample and not by way of limitation, the social-networking system 160may parse through a filename, creator information, or other suitableinformation associated with the metadata. The social-networking system160 may also parse through text directly associated with thevisual-media item such as the description and/or title of thevisual-media item linked in the post 410 to identify, among others, thefollowing n-grams: trololo cat; cat sings; eduard khil; cat sings likeeduard khil; butt; butt is scratched. In particular embodiments, thesocial-networking system 160 may perform one or more suitablepre-processing steps, such as removing certain numbers and punctuation(including the “#” character in a hashtagged term), removing orreplacing special characters and accents, lower-casing all text, othersuitable pre-processing steps, or any combination thereof. In particularembodiments, the social-networking system 160 may use a termfrequency-inverse document frequency (TF-IDF) analysis to removeinsignificant terms from the search query. The TF-IDF is a statisticalmeasure used to evaluate how important a term is to a document (e.g., aparticular communication on the online social network that is associatedwith one or more visual-media items) in a collection or corpus (e.g., aset of communications on the online social network that include one ormore visual-media items). The less important a term is in the collectionor corpus, the less likely it may be that the term will be extracted asan n-gram. The importance increases proportionally to the number oftimes a term appears in a particular document, but is offset by thefrequency of the term in the corpus of documents. The importance of aterm in a particular document is based in part on the term count in adocument, which is simply the number of times a given term (e.g., aword) appears in the document. This count may be normalized to prevent abias towards longer documents (which may have a higher term countregardless of the actual importance of that term in the document) and togive a measure of the importance of the term t within the particulardocument d. Thus we have the term frequency tf(t,d), defined in thesimplest case as the occurrence count of a term t in a document d. Theinverse-document frequency (idf) is a measure of the general importanceof the term which is obtained by dividing the total number of documentsby the number of documents containing the term, and then taking thelogarithm of that quotient. A high weight in TF-IDF is reached by a highterm frequency in the given document and a low document frequency of theterm in the whole collection of documents; the weights hence tend tofilter out common terms. As an example and not by way of limitation,referencing FIG. 4, a TF-IDF analysis of the text of the post 410 (e.g.,“this is a very cool cat video”) may determine that the n-gram “cat”should be extracted as an n-gram, where this term have high importancewithin the post. Similarly, a TF-IDF analysis of the text in the postmay determine that the n-grams “this,” “is,” and “a” should not beextracted as n-grams, where these terms have a low importance within thepost (e.g., because it may be a common term in many communications onthe online social network that include visual-media items or in titlesor descriptions of visual-media items, and therefore may not help narrowthe set of search results in any nontrivial manner). More information ondetermining term importance may be found in U.S. patent application Ser.No. 14/877,624, filed 7 Oct. 2015, which is incorporated by reference.In particular embodiments, the social-networking system 160 may filterout non-descriptive n-grams (i.e., n-grams that are unlikely to bedescriptors of visual concepts). This filtering process may be based ona pre-generated list of non-descriptive n-grams. As an example and notby way of limitation, the pre-generated list may include n-grams such as“throwback Thursday” (e.g., a term that may be used simply to signifythat a visual-media item is from the past and may otherwise have nothingto do with any visual concepts in the visual-media item). Thepre-generated list may be curated or may be populated using a suitablemachine-learning process. In particular embodiments, thesocial-networking system 160 may translate media items (e.g., emojis,photos, audio files, etc.) that are within the communications to n-gramsusing a video index or other media index, as described in U.S. patentapplication Ser. No. 14/952,707, filed 25 Nov. 2015, which isincorporated by reference. After one or more of these processes areperformed, the social-networking system 160 may be left with a set ofn-grams that are likely to be descriptors of a visual concept. Inparticular embodiments, it is only this set of n-grams that is“extracted” for the purposes of this disclosure. Although thisdisclosure describes extracting n-grams from particular sources in aparticular manner, it contemplates extracting any suitable unit ofinformation from any suitable sources in any suitable manner.

FIG. 5 illustrates an example view of an embedding space 500. Inparticular embodiments, the social-networking system 160 may generate,in a d-dimensional space, an embedding for each of the visual-mediaitems. The location of the embedding for the visual-media item may bebased on the one or more visual concepts included in the visual-mediaitem. Within this disclosure, embeddings for visual-media items will betermed “v-embeddings,” merely to avoid confusion with embeddings forn-grams (as described herein), which will be termed “n-embeddings.”While they are termed differently, within the d-dimensional space, theymay behave the same way and only differ in the sense that theycorrespond to different types of information (i.e., v-embeddingscorrespond to visual-media items, while n-embeddings correspond ton-grams). Although the embedding space 500 is illustrated as athree-dimensional space, it will be understood that this is forillustrative purposes only. The embedding space 500 may be of anysuitable dimension. In particular embodiments, the social-networkingsystem 160 may, at any suitable time (e.g., upon upload of avisual-media item or the posting of a communication referencing avisual-media item, or shortly thereafter), map a visual-media item tothe embedding space 500 as a vector representation (e.g., ad-dimensional vector). As an example of mapping a visual-media item toan embedding space, referencing FIG. 4, when the post 410 is firstposted, the social-networking system 160 may map the visual-media itemonto a vector using a deep-learning model (e.g., a convolutional neuralnetwork) based on information associated with the visual-media item. Thedeep-learning model may have been trained using a sequence of trainingdata (e.g., a corpus of images from videos or photos on the onlinesocial network). The vector representation may be based on one or morevisual features or visual concepts associated with the visual-mediaitem, and may be a symbolic representation of the visual features orvisual concepts. In particular embodiments, a visual-media item may havemultiple embeddings to account for different visual concepts included inthe visual-media item. As an example and not by way of limitation,referencing FIGS. 3A and 3B, the visual-media item 310 may have av-embedding that is based on the segment 340 (e.g., depicting a visualconcept that may be recognized by a human as a cat) and a separatev-embedding that is based on the segment 350 (e.g., depicting a visualconcept that may be recognized by a human as a window). In this way, thesame visual-media item may be used by the social-networking system 160in identifying multiple visual concepts and associating n-grams that maybe descriptors of the multiple visual concepts. Although this disclosuredescribes generating particular embeddings in a particular manner, itcontemplates generating any suitable embedding in any suitable manner.

In particular embodiments, the different visual features of the visualconcepts associated with a visual-media item may determine theproperties (e.g., magnitude, direction) of its respective vector in thed-dimensional space. As an example and not by way of limitation,referencing FIGS. 3A and 3B, the vector of the visual-media item 310 maybe based on visual features of the visual concept depicted in thesegment 320 and the vector of the visual-media item 330 may be based onthe visual features of the visual concept depicted in the segment 340.The vector may provide coordinates corresponding to a particular point(e.g., the terminal point of the vector) in an embedding space. Theparticular point may be an “embedding” for the respective visual-mediaitem. As an example and not by way of limitation, referencing FIG. 5,the v-embedding 510 may be a coordinate of a terminal point of a vectorrepresentation of a first visual-media item and the v-embedding 520 maybe a coordinate of a terminal point of a vector representation of asecond visual-media item. The location of each v-embedding may be usedto describe the visual concepts associated with a respectivevisual-media item. In particular embodiments, since the vectorrepresentations of visual-media items, and therefore their respectiveembeddings, are based on the visual features of the visual conceptsassociated with the visual-media items, visual-media items that sharevisual concepts may be located relatively close to each other. Bycontrast, embeddings of visual-media items that do not share suchconcepts may be located relatively far apart from each other. As anexample and not by way of limitation, referencing FIGS. 3A, 3B, and 5,the v-embedding 510 may correspond to the visual-media item 310, and thev-embedding 520 may correspond to the visual-media item 330, becausethey share at least one visual concept (e.g., depicted in the segments320 and 340). By way of a contrasting example and not by way oflimitation, the v-embedding 540 may correspond to a visual-media item ofa car that does not include a visual concept with visual featuressimilar to those in the visual-media items 310 and 330. This trait ofthe embeddings in the d-dimensional space may group visual-media itemsthat share visual concepts closer together, and may effectively be usedto demarcate areas in the d-dimensional space that are associated withparticular visual concepts, as further described herein.

In particular embodiments, the properties of a vector representation mayalso be based on an image-recognition process (e.g., running natively onthe social-networking system 160, running on a third-party system 170)that determines social-graph concepts (i.e., concepts represented byconcept nodes 204 of the social graph 200) associated with thevisual-media item. This association may provide an additional clue as towhat a respective visual concept may be by effectively functioning as anadditional descriptor of the visual concept. In particular embodiments,the image-recognition process may identify the visual features of thevideo and associate them with one or more social-graph concepts. As anexample and not by way of limitation, referencing FIG. 4, thesocial-networking system 160 may identify visual features (e.g., shape,color, texture) in the visual-media item associated with the post 410and may determine, based on an image-recognition process that uses thevisual features as inputs, that the visual-media item is associated withthe social-graph concept “Cat.” More information on determiningsocial-graph concepts in images may be found in U.S. patent applicationSer. No. 13/959,446, filed 5 Aug. 2013, and U.S. patent application Ser.No. 14/983,385, filed 29 Dec. 2015, each of which is incorporated byreference. In particular embodiments, the social-graph concepts may bedetermined based on associations between a context associated withvisual-media items and one or more social-graph concepts. As an exampleand not by way of limitation, a visual-media item posted on a page orinterface related to the social-graph concept “Batman” may be associatedwith that social-graph concept. In particular embodiments, social-graphconcepts may be determined based on one or more audio features of avisual-media item. As an example and not by way of limitation, aspeech-recognition process may recognize the word “cat” being spoken bya person in the visual-media item associated with the post 410, in whichcase, the social-networking system 160 may associate the visual-mediaitem with the social-graph concept “Cat.” As another example and not byway of limitation, a voice-recognition process may recognize the voiceof a particular person (e.g., a user, a celebrity) and associate thevisual-media item with a social-graph concept that describes that person(e.g., the social-graph concept that corresponds directly to the user orthe celebrity). As another example and not by way of limitation, anaudio-recognition process may detect that the visual-media itemassociated with the post 410 includes a song by the artist Cat Stevens,in which case the social-networking system 160 may associate thevisual-media item with the social-graph concept “Cat Stevens.” Inparticular embodiments, associated social-graph concepts may bedetermined based on text associated with the video. As an example andnot by way of limitation, the text may have been extracted fromcommunications associated with the visual-media item. As another exampleand not by way of limitation, the text may have been extracted frommetadata (e.g., the filename, time and location of upload, etc.)associated with the visual-media item or text directly associated withthe visual-media item (e.g., the title, a description, etc.). In theseexamples, the social-networking system 160 may determine associatedsocial-graph concepts by using a topic index to match the extracted textwith keywords indexed with respective social-graph concepts, and maydetermine the vector representation based on these concepts. Moreinformation on using a topic index to determine concepts associated withtext may be found in U.S. patent application Ser. No. 13/167,701, filed23 Jun. 2011, and U.S. patent application Ser. No. 14/561,418, filed 5Dec. 2014, each of which is incorporated by reference. In particularembodiments, associated social-graph concepts may be determined based oninformation associated with one or more users associated with thevisual-media item. As an example and not by way of limitation, avisual-media item created by a user who with profile informationindicating an interest in boxing may be associated with the social-graphconcept “Boxing” or any other suitable concepts.

In particular embodiments, the social-networking system 160 maygenerate, in the d-dimensional space, an embedding for each of theextracted n-grams of communications or other sources, such as titles ordescriptions, associated with visual-media items. As mentioned, theseembeddings will be referred to herein as n-embeddings to avoidconfusion. By embedding both n-grams and visual-media items in the samed-dimensional space, the social-networking system 160 creates what maybe termed a “joint embedding model.” In particular embodiments, thesocial-networking system 160 may generate n-embeddings just as itgenerates v-embeddings: by mapping n-grams to the embedding space 500 asvectors and then determining particular points of the vectors (e.g., theterminal points of the vectors) as embeddings for the respectivevectors. In particular embodiments, the properties of the vectorrepresentations of n-embeddings may be based on a frequency ofoccurrence of the n-gram in the communications (or other sources)associated with the visual-media items. Essentially, this may be basedon the idea that the text of communications associated with avisual-media item may include n-grams that describe visual concepts inthe visual-media item. As an example and not by way of limitation,referencing FIG. 4, the post 410 and the comment 420, both beingassociated with the visual-media item referenced by the link, includethe n-grams “cat” and “gato” (Spanish for the word “cat”). These n-gramsmay be describing a visual concept in the associated visual-media item,namely, the visual concept corresponding to what a human may perceive asa depiction of a cat. These n-grams may occur more frequently incommunications associated with visual-media items including this visualconcept (or, for example, in titles or descriptions of the visual-mediaitems) than the n-gram “dog.” While the n-gram “dog” may occur in someof these communications (e.g., as in the comment 430 in FIG. 4), in theaggregate, the overall occurrence of “dog” may be markedly less frequentthan that of “cat” or “gato.” The ability to associate n-grams of anylanguage (be it English, Spanish, or any other language) with visualconcepts and visual-media items illustrates just one of the technicalimprovement over prior processes of the particular language-agnostictraining process described herein.

In particular embodiments, the social-networking system 160 may engagein a training phase that makes use of one or more training techniques todetermine the locations of n-embeddings and v-embeddings in thed-dimensional space, and the n-grams that are associated with visualconcepts based on these locations. In particular embodiments, thesocial-networking system 160 may train the joint embedding model using atriplet loss algorithm, which may analyze a large number (e.g.,thousands, millions) of information triplets, each information tripletconsisting of (1) a “triplet-query” (e.g., a media-item identifier thatcorresponds to a particular visual-media item including a particularvisual concept), (2) a “positive” (e.g., an extracted n-gram that wasused in greater than a threshold number of communications that includedthe particular visual-media item or another visual-media item having theparticular visual concept), and (3) “a negative” (e.g., an extractedn-gram that was not used in a minimum number of communications thatincluded the particular visual-media item or another visual-media itemhaving the particular visual concept). As an example and not by way oflimitation, with a triplet-query that corresponds to a visual-media itemof a cat, the positive may be the n-gram “cat” (e.g., because it mayhave been used in greater than a threshold number of communications) andthe negative may be the n-gram “dog” (e.g., because it may have beenused in less than a minimum number of communications). In particularembodiments, the threshold number may be higher than the minimum number.As an example and not by way of limitation, the threshold number may be1000 while the minimum number may be 10. Upon analyzing a large numberof such triplets, the social-networking system 160 may map n-embeddingssuch that they are located relatively near v-embeddings of visual-mediaitems for which the respective n-grams were positives and relatively farfrom visual-media items for which they were negatives. In particularembodiments, the relative distances may be based on (e.g., may bedirectly or indirectly proportional to) the frequency of occurrence. Asan example and not by way of limitation, the n-embedding for the n-gram“dog” may be located closer that the word “canine” (another word thatmay be used to refer to dogs) to v-embeddings of visual-media itemshaving the visual concept corresponding to what a human may perceive tobe a dog (e.g., because “dog” may be used more frequently than “canine”in communications including these visual-media items). In particularembodiments, the distance between the embedding for each positive n-gramand the embedding for the particular visual-media item may be less thanthe distance between the embedding for each negative n-gram and theembedding for the particular visual-media item. The mappings may occurafter a comprehensive analysis of the large number of triplets or mayoccur iteratively as the analysis is being performed. At the outset ofthis training phase, the social-networking system 160 may developembeddings for a number of visual-media items and n-grams. As an exampleand not by way of limitation, referencing FIG. 5, the embedding space500 includes a plurality of v-embeddings and n-embeddings, which may bebased on the training process described herein. For example, thesocial-networking system 160 may compile the occurrences of the positiven-grams and the negative n-grams from information triplets for aparticular visual-media item that includes a particular visual concept.The social-networking system 160 may then determine counts of eachpositive n-gram and negative n-gram, and may determine the locations oftheir respective n-embeddings based on the counts and based on thelocations of the embeddings of the visual-media items that include theparticular visual concept. As an example and not by way of limitation,n-embeddings of positive n-grams with relatively high counts may belocated relatively close to the visual-media items. As another exampleand not by way of limitation, n-embeddings of negative n-grams withrelatively high counts may be located relatively far from thevisual-media items. In particular embodiments, the social-networkingsystem 160 may also perform a softmax function process. This may occurbefore the triplet loss algorithm, which may provide added efficiency tothe training process. The softmax function may examine individualextracted n-grams and associate them with visual concepts appearing intheir respective visual-media items. In particular embodiments, thesoftmax function may only allow the association of one n-gram at a timefor a particular instance of a visual-media item. As an example and notby way of limitation, referencing FIG. 4, for the instance of thevisual-media item included in the post 410, the softmax function mayonly consider the n-gram “cat.” In particular embodiments, once trainingwith the softmax function has progressed to a level where a steady stateis achieved, the social-networking system 160 may transition to a binarycross-entropy analysis, which may allow the social-networking system 160to associate multiple descriptor n-grams at a time for an instance of avisual-media item. Although this disclosure focuses on generatingembeddings for n-grams extracted from communications in a particularmanner, it contemplates generating embeddings for n-grams extracted fromany suitable source (e.g., titles, descriptions, or other sources thatmay be included in metadata of a visual-media item) in any suitablemanner. More information on the use of triplet loss algorithms toassociate n-grams with visual concepts or visual-media items may befound in the following paper, which is incorporated by reference: ArmandJoulin et al., Learning Visual Features from Large Weakly SupervisedData, arXiv:1511.02251, Nov. 6, 2015. Although this disclosure describesassociating particular n-grams with particular concepts and particularmedia items in a particular manner, it contemplates associating anysuitable n-grams or other information with any suitable concepts anditems in any suitable manner

In particular embodiments, the social-networking system 160 may continuetraining indefinitely and may continue to update the d-dimensional spaceaccordingly with new embeddings, creating new n-gram associations in theprocess. As an example and not by way of limitation, the training mayoccur periodically (or as updates become necessary) to keep thesocial-networking system 160 updated. These updates may be beneficial asnew n-grams come to represent existing visual concepts. As an exampleand not by way of limitation, new slang terms may develop to describeexisting visual concepts, in which case the d-dimensional space may beupdated to include n-embeddings for these visual concepts. As anotherexample and not by way of limitation, n-grams for languages that may notyet have been indexed may begin to appear as the number ofcommunications with visual-media items in those languages increase. Theupdates may also be beneficial in cases where new visual conceptsdevelop. As an example and not by way of limitation, a visual conceptdescribing a cellular phone may not have existed in visual-media items(or generally) before the advent of cellular phones. In this example, asvisual-media items with segments depicting the visual conceptcorresponding to cell phones are uploaded and as the social-networkingsystem 160 extracts n-grams associated with these visual-media items,the d-dimensional space may be updated and new n-gram associations maybe made (e.g., equating the visual concept with the n-gram “cellphone”).

In particular embodiments, the social-networking system 160 mayassociate, with the shared visual concept, one or more of the extractedn-grams that have embeddings within a threshold area of the v-embeddingsfor the identified visual-media items. The threshold area may describean area associated with the shared visual concept. As an example and notby way of limitation, referencing FIG. 5, the threshold area 570 maycorrespond to a particular shared visual concept (e.g., referencingFIGS. 3A and 3B, the visual concept depicted in segments 320 and 340).In particular embodiments, the threshold area may be determined based ona threshold distance from a point in the d-dimensional space where theshared visual concept is estimated to be. As an example and not by wayof limitation, referencing FIG. 5, the threshold area may be an areadefined by a threshold distance from the point 580. The location of thispoint may be based on the location of v-embeddings of the visual-mediaitems associated with the shared visual concept. As an example and notby way of limitation, the location of the point may be a modal point ofthe v-embeddings of the visual-media items associated with the sharedvisual concept (e.g., defined by averaging the coordinates of thev-embeddings of the visual-media items). The threshold area may bedetermined in any suitable manner. As an example and not by way oflimitation, a Euclidean distance formula may be applied, wheredistance=√{square root over (Σ_(i=1) ^(d)(p_(i)−q_(i))²)}, and where prepresents the coordinates of the point where a visual concept isestimated to be (e.g., referencing FIG. 5, the point 580) and qrepresents the coordinates of a point on an outer boundary, fordimensions i=1 to d. In this example, the distance may be set to aparticular value, and the threshold area may be extrapolated fromdetermining a plurality of points q that satisfy the equation.

In particular embodiments, the social-networking system 160 may populatea visual-concept index or an equivalent thereof that associates visualconcepts with n-grams based on the joint embedding model. A visualconcept in the visual-concept index may be indexed in alanguage-agnostic manner that relies on visual features associated withthe visual concept and does not rely on text to define the visualconcept. As an example and not by way of limitation, referencing FIGS.3A and 3B, the visual concept depicted in the segments 320 and 340 maynot be defined in the index by words like “cat” or “gato” (i.e., Spanishfor “cat”) and may instead be defined by the visual features of thesegments such as the shape, texture, or color of the depiction of whatmay appear to a human as a cat in the visual-media items 310 and 330.One advantage of this language-agnostic definition is that such adefinition is universal and does not require translating among languagesto index visual-media items. Relatedly, this type of definition allowsvisual concepts to be associated with any term that is commonlyassociated with those visual concepts, including common misspellings(e.g., associating the n-gram “catt” with the visual concept that ahuman may recognize as a cat) and new slang (e.g., associating the slangterm “whip” with a visual concept that a human may recognize as a car).In particular embodiments, rather than relying on text, a visual conceptin the visual-concept index may be indexed by a corresponding visualconcept identifier number, by corresponding data describing theproperties of its respective d-dimensional vector or coordinates of itsrespective embedding, etc.

In particular embodiments, the social-networking system 160 may make useof the joint embedding model to identify visual-media items to return assearch results in response to a search query for visual-media items. Inthe joint embedding training model, the locations of n-embeddings may beused to identify visual-media items responsive to a search query, basedon the locations of the v-embeddings corresponding to the visual-mediaitems. As an example and not by way of limitation, referencing FIG. 5,the n-embeddings 530 and 540 may be relatively close in proximity to thev-embeddings 510 and 520 (e.g., as determined by them being within thethreshold area 570. This may indicate that a search query including then-gram corresponding to the n-embedding 530 or the n-gram correspondingto the n-embedding 540 may be directed to a visual concept that ispresent in the visual-media items corresponding to the v-embeddings 510and 520. This property of the joint-embedding model may be leveraged inexecuting search queries for visual-media items that include one or moreof the n-grams having embeddings. When a user submits a search query,the social-networking system 160 may determine that the search queryincludes a particular n-gram for which there exists an n-embedding inthe d-dimensional space. The social-networking system 160 may thenreturn visual-media items with v-embeddings that are near then-embedding of the particular descriptor n-gram in the embedding space(e.g., within a threshold distance of the v-embedding, within thethreshold area associated with a visual concept within which both then-embedding and the v-embedding are located). As an example and not byway of limitation, if the search query includes the descriptor n-gram“gato” (i.e., the Spanish equivalent of “cat”), which may correspond toan n-embedding close to v-embeddings of visual-media items that depict avisual concept that a human may recognize as a cat, thesocial-networking system 160 may return those visual-media items to theuser. As another example and not by way of limitation, referencing FIG.5, if the search query includes an n-gram corresponding to then-embedding 540, the social-networking system 160 may return as searchresults one or more of the visual-media items whose embeddings are inthe threshold area 570, which may be associated with a particular visualconcept. In this example, the social-networking system 160 may returnthe visual-media items corresponding to the v-embeddings 510 and/or 520,among others. In particular embodiments, the social-networking system160 may rank the search results based on the proximity of thev-embeddings of their respective visual-media items to an n-embedding ofan n-gram in the search query. If the social-networking system 160determines that a search query is directed to multiple visual concepts(e.g., the search query for “cat sitting by the window” may be directedto a visual concept that a human may recognize as a cat and a visualconcept that a human may recognize as a window), the social-networkingsystem 160 may further rank visual-media items based on proximity oftheir respective embeddings to the n-embeddings of the n-grams in thequery directed to each of those visual concepts. In identifying andranking responsive visual-media items, the social-networking system 160may also consider other sources of information associated with thevisual-media items (e.g., text from the title, description, aspeech-recognition process, etc.). As another example and not by way oflimitation, with respect to a search query for “grumpy cat,” avisual-media item that is close in proximity to the n-embeddingassociated with the n-gram “cat” and also has in its title the n-grams“grumpy cat” may be ranked higher than a similar visual-media item thatdoes not have those n-grams in its title. As an example and not by wayof limitation, speech recognition may recognize the words “grumpy cat”being spoken by in a video and may correspondingly increase the rank ofsuch video. Using the joint embedding model to execute queries forvisual-media items may be quicker and more efficient, and may producemore high-quality results than other search methods, such as searchmethods that merely attempt to match n-grams of the search query withkeywords associated with visual-media items.

In particular embodiments, the social-networking system 160 may segmenta search query into one or more query-segments, each of which mayinclude one or more n-grams of the search query. In particularembodiments, the social-networking system 160 may parse the text of thesearch query using one or more of the pre-processing steps describedherein (e.g., a TF-IDF analysis that filters out insignificant termsfrom the search query). As an example and not by way of limitation, thesocial-networking system 160 may segment the search query “cat sittingby the window,” into, among others, the following set of sequentialn-grams: “cat” “cat sitting,” “window.” The social-networking system 160may generate a reconstructed embedding of the search query based on oneor more n-embeddings associated with one or more of the n-grams of thesearch query. A function

may map an input to a reconstructed embedding of the input in anembedding space. In particular embodiments, the reconstructed embeddingof the search query may be generated by pooling the one or moren-embeddings associated with the one or more of the n-grams of thesearch query, respectively. As an example and not by way of limitation,for a search query q comprising n-grams n₁ through n_(k),

(q) may be a pooling of the term embeddings for n₁ through n_(k). Inparticular embodiments, the pooling may comprise one or more of a sumpooling, an average pooling, a weighted pooling, a pooling with temporaldecay, a maximum pooling, or any other suitable pooling. As an exampleand not by way of limitation, the pooling may be a sum pooling, suchthat

(q)=Σ_(i=1)

(t_(i)). Building on the previous example and not by way of limitation,for the search query “cat sitting by the window,”

(q) may be calculated as

(q)=

(“cat”)+

(“cat sitting”)+

(“window”)+ . . . +

(n_(k)). As another example and not by way of limitation, the poolingmay be an average pooling, such that

${\overset{\rightharpoonup}{\Pi}(q)} = {\frac{1}{k}{\sum\limits_{i = 1}^{k}{{\overset{\rightharpoonup}{\pi}\left( n_{i} \right)}.}}}$In particular embodiments, the social-networking system 160 may identifyvisual-media items responsive to the search query based on the locationof the reconstructed embedding of the search query in the d-dimensionalspace with respect to the locations of the visual-media items in thed-dimensional space (e.g., based on proximity as determined by Euclideandistance calculations, based on cosine similarities of the respectivevectors).

FIG. 6 illustrates an example method 600 for associating n-grams withidentified visual concepts. The method may begin at step 610, where thesocial-networking system 160 may identify a shared visual concept in twoor more visual-media items, wherein each visual-media item comprises oneor more images, each image comprising one or more visual features, andwherein each visual-media item comprises one or more visual concepts,the shared visual concept being identified based on one or more sharedvisual features in the respective images of the visual-media items. Atstep 620, the social-networking system 160 may extract, for each of thevisual-media items, one or more n-grams from one or more communicationsassociated with the visual-media item. At step 630, thesocial-networking system 160 may generate, in a d-dimensional space, anembedding for each of the visual-media items, wherein a location of theembedding for the visual-media item is based on the one or more visualconcepts included in the visual-media item. At step 640, thesocial-networking system 160 may generate, in the d-dimensional space,an embedding for each of the extracted n-grams, wherein a location ofthe embedding for the n-gram is based on a frequency of occurrence ofthe n-gram in the communications associated with the visual-media items.At step 650, the social-networking system 160 may associate, with theshared visual concept, one or more of the extracted n-grams that haveembeddings within a threshold area of the embeddings for the identifiedvisual-media items. Particular embodiments may repeat one or more stepsof the method of FIG. 6, where appropriate. Although this disclosuredescribes and illustrates particular steps of the method of FIG. 6 asoccurring in a particular order, this disclosure contemplates anysuitable steps of the method of FIG. 6 occurring in any suitable order.Moreover, although this disclosure describes and illustrates an examplemethod for associating n-grams with identified visual concepts includingthe particular steps of the method of FIG. 6, this disclosurecontemplates any suitable method for associating n-grams with identifiedvisual concepts including any suitable steps, which may include all,some, or none of the steps of the method of FIG. 6, where appropriate.Furthermore, although this disclosure describes and illustratesparticular components, devices, or systems carrying out particular stepsof the method of FIG. 6, this disclosure contemplates any suitablecombination of any suitable components, devices, or systems carrying outany suitable steps of the method of FIG. 6.

Training Image-Recognition Systems Based on Search Queries

The extensive and continuous nature of the training of n-grams tovisual-media items and visual concepts as described herein may introduceseveral challenges for the social-networking system 160. First, thesocial-networking system 160 may only be able train for a finite numberof visual concepts within a given period of time, such that thesocial-networking system 160 may be unable to be trained for everypossible visual concept. Second, new visual concepts and n-gramsdescribing them may constantly be emerging and the social-networkingsystem 160 may need to be able to train for these visual concepts asthey emerge and become important to the user base. As an example and notby way of limitation, the n-gram “smartphone” and its associated visualconcept may not have existed before the first smartphone was released,such that the requisite associations may not have yet been trained for.The methods described herein attempt to solve problems such as these byusing search-query metrics that describe what n-grams are popularlysearched for, and by extension, what visual concepts are popularlysearched for, to strategically select the visual concepts and n-grams totrain for. The social-networking system 160 may use search-query metricsto determine what n-grams are popular in search queries submitted byusers (e.g., n-grams used in a threshold number of queries) and may thentrain those n-grams to their respective visual concepts if they have notalready been trained for. The social-networking system 160 may trainthese popular n-grams to their respective visual concepts using anysuitable method such as the ones described here (e.g., by mapping thesen-grams onto n-embeddings in the joint embedding model). As an exampleand not by way of limitation, if users are frequently submitting searchqueries that include the n-gram “batman” and if the social-networkingsystem 160 has not associated that n-gram with a visual concept, thesocial-networking system 160 may select that n-gram for training.Selecting visual concepts and n-grams strategically in this manner mayprovide the technical benefit of improving the efficiency of training avisual-concept recognition system by training for visual concepts andn-grams that are relevant to a search functionality. It further ensuresthat the social-networking system 160 trains for the most up-to-datevisual concepts.

In particular embodiments, the social-networking system 160 may receive,from a plurality of client systems 130 of a plurality of users, aplurality of search queries. Each of the search queries may include oneor more n-grams. The social-networking system 160 may identify a subsetof search queries from the plurality of search queries as being queriesfor visual-media items. The social-networking system 160 may determinethat a search query is a query for visual-media items based on one ormore n-grams of the search query being associated with visual-mediacontent. The social-networking system 160 may calculate, for each of then-grams of the search queries of the subset of search queries, apopularity-score. The popularity-score may be based on a count of thesearch queries in the subset of search queries that include the n-gram.The social-networking system 160 may determine one or more popularn-grams based on the n-grams of the search queries of the subset ofsearch queries. The popular n-grams may be n-grams of the search queriesof the subset of search queries having a popularity-score greater than athreshold popularity-score. The social-networking system 160 may selectone or more of the popular n-grams for training a visual-conceptrecognition system. Each of these popular n-grams may be selected basedon whether it is associated with one or more visual concepts. As anexample and not by way of limitation, the social-networking system 160may forgo the selection of a popular n-gram if it determines that thepopular n-gram is already associated with one or more visual concepts.

In particular embodiments, the social-networking system 160 may receive,from a plurality of client systems 130 of a plurality of users, aplurality of search queries. The search queries may include may includeone or more n-grams. In particular embodiments, one or more of thesearch queries may include one or more media items that may beassociated with one or more n-grams, in which case, thesocial-networking system 160 may translate these media items inton-grams (i.e., the social-networking system 160 may treat the searchquery as though it included the n-grams associated with the image). Asan example and not by way of limitation, a search query may include avisual-media item (e.g., an image in the case of an image search), andthe social-networking system 160 may be able to recognize the image orvisual concepts in the image (e.g., using an image-recognition systemsuch as the one described herein). In this example, thesocial-networking system 160 may translate the image into its associatedn-grams. As another example and not by way of limitation, thesocial-networking system 160 may be able to associate a media item(visual or otherwise) in a search query with n-grams that may be indexedwith the media item in a media index (e.g., one that indexes videos,audio, images, etc. with associated n-grams), which may be populated asdescribed in U.S. patent application Ser. No. 14/952,707, filed 25 Nov.2015, which is incorporated by reference. In particular embodiments, thesocial-networking system 160 may extract one or more of the n-grams ofeach search query (or associated with the search query, e.g., based onmedia items in the search query). The social-networking system 160 mayonly extract certain n-grams, as described herein (e.g., afterperforming a TF-IDF analysis that filters out insignificant terms fromthe search query, after filtering out other n-grams that may be unlikelyto describe visual concepts). Although this disclosure describesreceiving particular search queries from particular systems in aparticular manner, it contemplates receiving any suitable search queriesfrom any suitable system in any suitable manner.

In particular embodiments, the social-networking system 160 may identifya subset of search queries from the plurality of search queries as beingqueries for visual-media items. In determining whether a particularsearch query is a query for visual-media items, the social-networkingsystem 160 may effectively be making a prediction as the search intentof the user submitting the search query. In particular embodiments, thesocial-networking system 160 may perform this identification step as ameans of narrowing down the search queries that need to be considered indetermining the n-grams that need to be trained for using thevisual-concept recognition system. By narrowing down the search queriesto this subset of queries for visual-media items, the social-networkingsystem 160 may filter out irrelevant metrics related to n-grams that mayhave nothing to do with visual concepts (e.g., because a user who is notsearching for a visual-media item may not likely be describing a visualconcept in the search query). This filtering may be advantageous becauseit may prevent erroneous data from influencing the determination of thepopular n-grams to train for (e.g., by eliminating from considerationthose n-grams that are unlikely to be directed to a visual concept) andbecause it may reduce the number of overall queries to process. Theidentification of the subset may be based on any suitable combination ofone or more of the factors described herein. In particular embodiments,the social-networking system 160 may determine that a search query is aquery for visual-media items if the search query is a bounded query,i.e., a search query that is specifically restricted to only returnvisual-media items. As an example and not by way of limitation, the usermay select a filter or select an element from a dropdown menu thatspecifies that the search results should be visual-media items. Inparticular embodiments, the social-networking system 160 may determinethat a search query is a query for visual-media items based on one ormore n-grams of the search query being associated with visual-mediacontent. As an example and not by way of limitation, thesocial-networking system 160 may determine that a search query is aquery for a visual-media item if it includes n-grams such as “video,”“photo,” or “picture” that may explicitly indicate an intent to searchfor visual-media items. As another example and not by way of limitation,the social-networking system 160 may determine that a search query is aquery for visual-media items if it includes n-grams that are commonlyassociated with visual-media items and therefore imply an intent tosearch for visual-media items (e.g., a search query for “beyonce singleladies” which may have a combination of n-grams commonly associated witha popular music video). In these examples, the social-networking system160 may have a pre-generated list of such n-grams that it comparesagainst the n-grams of search queries for this purpose. Thepre-generated list may be curated and/or may be the product of asuitable machine-learning process that identifies n-grams associatedwith videos. In particular embodiments, the determination may be basedon a search context from which the search query is submitted. As anexample and not by way of limitation, if the search query is submittedfrom an interface that is dedicated to visual-media items, that mayindicate a likelihood that the query is for visual-media items. In thisexample, a user may have submitted the search query from avideo-search-results page or an image-search-results page, which mayimply that the user may be interested in searching for visual-mediaitems. As another example and not by way of limitation, if the searchquery is submitted from an interface that is otherwise associated withvisual-media items, that may indicate a likelihood that the query is forvisual-media items. In this example, a user may have submitted a searchquery from a page on the online social network that is associated withmovie trailers, which may imply that the user may be interested insearching for visual-media items. In particular embodiments, thedetermination may be based on a results-set analysis, in which thesearch query may be executed on the back end to determine a number or apercentage of potential search results that are visual-media items. Asufficiently large number or percentage (e.g., one that is greater thana threshold value) of visual-media-item search results may indicate thatthe search query is likely a query for visual-media items. Theresults-set analysis may weight the number or percentage based on therelevance or quality of each visual-media-item search result. As anexample and not by way of limitation, the results-set analysis mayweight an occurrence of a visual-media-item search result that is of arelatively high relevance (e.g., as may be determined by the proximityof the embedding of the visual-media item to an embedding of the searchquery or embeddings of the n-grams of the search query) more highly thanan occurrence of a less relevant visual-media-item search result. Moreinformation on performing a results-set analysis may be found in U.S.patent application Ser. No. 15/228,771, filed 4 Aug. 2016, which isincorporated by reference. In particular embodiments, the determinationmay be based on a number of times that prior searches including one ormore n-grams of the search query resulted in a user (e.g., the user whosubmitted the search query) requesting to access a visual-media item. Asan example and not by way of limitation, if a search query including then-gram “james bond” often results in querying users submitting requeststo view one or more visual-media items (e.g., by selecting aninteractive element corresponding to a visual-media-item search resulton a search-results interface presented to the querying user followingthe execution of the search query), that may indicate that the searchquery is likely a query for visual-media items. In particularembodiments, the determination may be based on information associatedwith the user submitting the search query. As an example and not by wayof limitation, a search query from a user who submits search queries forvideos relatively frequently may be more likely to be a query for avisual-media item than a search query from a user who does not submitqueries for visual-media items as frequently. As another example and notby way of limitation, a search query submitted by a user who is of ademographic that submits search queries for visual-media itemsrelatively frequently may be more likely to be a query for avisual-media item than a search query from a user who is of ademographic that does not submit queries for visual-media items asfrequently. Although this disclosure describes identifying particularsearch queries in a particular manner, it contemplates identifying anysuitable search queries in any suitable manner.

In particular embodiments, the social-networking system 160 maycalculate, for each of the n-grams of the search queries of the subsetof search queries, a popularity-score. The popularity-score of an n-grammay be an indication of the popularity of an n-gram as a search term inqueries for visual-media items. In particular embodiments, thepopularity-score of an n-gram may be based on a count of the searchqueries in the subset of search queries that include the n-gram. Inparticular embodiments, in calculating popularity-scores, thesocial-networking system 160 may weight the count of the search queriesincluding the n-gram, weighting each occurrence of a search query basedon a degree of confidence with which the search query is identified asbeing a query for visual-media items. The degree of confidence may bebased on the manner in which the search query was identified as being aquery for visual-media items. As an example and not by way oflimitation, an occurrence of the n-gram “chewbacca mom” in the searchquery “chewbacca mom video” (e.g., determined to be a query forvisual-media items based on the presence of the n-gram “video,” whichmay be an explicit indication of an intent to search for visual-mediaitems) may be weighted higher than an occurrence of the same n-gram inthe search query “chewbacca mom in car” (e.g., determined to be a queryfor visual-media items based on the results set having a largepercentage of visual-media-item search results). In particularembodiments, the weighting of the occurrences of an n-gram may also bebased on information associated with the querying user (e.g., a user ofa client system 130 from which the search query was received). As anexample and not by way of limitation, the information may includedemographic information of the querying user. For example, n-gramoccurrences of search queries originating from users who are in the 18-to 29-year-old demographic may be weighted higher than search-termoccurrences originating from users over 85 years old (e.g., because theformer demographic may search for videos more than the latterdemographic, as may be determined by search-query metrics). As anotherexample and not by way of limitation, the information may include alevel of engagement of the querying user on the online social network(e.g., as determined by a degree of usage of the online social network).For example, n-gram occurrences of search queries originating from userswho have a relatively high engagement level on the social-networkingsystem 160 may be weighted higher than n-gram occurrences in searchqueries originating from users who do not have as high of an engagementlevel. As another example and not by way of limitation, the informationmay include a search history of the querying user (e.g., a searchhistory of the querying user on the online social network, which may bestored on the social-networking system 160 in associated with an accountof the querying user). For example, n-gram occurrences of search queriesoriginating from a querying user who submits search queries forvisual-media items relatively frequently (e.g., on the online socialnetwork, on a third-party system) may be weighted higher than n-gramoccurrences of search queries originating from a querying user who doesnot submit search queries for visual-media items as frequently. Asanother example and not by way of limitation, the information mayinclude geo-location information of the user, and the geo-locationinformation may be determined based on a geo-location of the clientsystem 130 from which the search query is received. For example, n-gramoccurrences of search queries submitted from a region where visual-mediaitems are not commonly searched for may be weighted less than n-gramoccurrences of search queries submitted from a region where visual-mediaitems are more commonly searched. In particular embodiments, a searchquery may be determined to be a query for visual-media items based onany suitable combination of the factors described herein, and the weightof n-gram occurrences in these search queries may be adjustedaccordingly in any suitable manner. The weighting of n-gram occurrencesin determining the popularity-score of an n-gram may be represented bythe following simplified equation:popularity-score=ƒ_(s)(ƒ₁(An₁)+ƒ₂(Bn₂)+ . . . ), where ƒ_(s) is ascaling function, ƒ₁ is a function applied to a number of n-gramoccurrences n₁ of search queries determined to be queries forvisual-media items in a first particular manner, ƒ₂ is a functionapplied to a number n-gram occurrences n₂ of search queries determinedto be queries for visual-media items in a second particular manner, andA and B are respective weights. In particular embodiments, an entity mayrequest or pay for an increase in one or more popularity-scores that areof interest. As an example and not by way of limitation, Acme LLC, astartup company, may pay for an increase in popularity-scores associatedwith the n-grams “acme” or “acme llc” so that these n-grams may be morequickly associated with a suitable visual concept (e.g., a trailer of anAcme LLC company logo, if in fact there are sufficient communicationsincluding these n-grams and associated with visual-media items includingthat logo). Although this disclosure describes calculating particularscores for particular n-grams in a particular manner, it contemplatescalculating any suitable scores for any suitable search units in anysuitable manner.

In particular embodiments, the social-networking system 160 maydetermine that one or more n-grams are popular n-grams based on then-grams of the search queries of the subset of search queries. Inparticular embodiments, the popular n-grams may be n-grams of the searchqueries of the subset of search queries having a popularity-scoregreater than a threshold popularity-score. In particular embodiments,the threshold popularity-score may be a threshold rank. As an exampleand not by way of limitation, at any point, only the n-grams with thetop twenty popularity-scores may be determined to be popular n-grams.Although this disclosure describes determining particular n-grams in aparticular manner, it contemplates determining any suitable n-grams (orother search units) in any suitable manner.

In particular embodiments, the social-networking system 160 may selectone or more of the popular n-grams for training a visual-conceptrecognition system (or prioritize the training of such n-grams among alist of n-grams selected for training). As described herein, a popularn-gram of a search query that is likely to be a query for visual-mediaitems may tend to be a descriptor of a visual concept (e.g., simplybased on the fact that users may tend to construct search queries forvisual-media items by describing visual concepts within the visual-mediaitem). Each of these popular n-grams may be selected based on whether itis associated with one or more visual concepts. As an example and not byway of limitation, if the social-networking system 160 calculates arelatively high popularity-score for the n-gram “mountain” (e.g., basedon a relatively high count of search queries including the n-gram“mountain”), and further determines that the n-gram “mountain” is notassociated with a visual concept (e.g., based on the n-embedding of then-gram not being within a threshold area of any particular visualconcept), the social-networking system 160 may focus on training thevisual-concept recognition system for the n-gram “mountain.” Inparticular embodiments, the social-networking system 160 may forgo theselection of a popular n-gram if it determines that the popular n-gramis already associated with one or more visual concepts. As an exampleand not by way of limitation, an n-gram may be associated with a visualconcept if it has an n-embedding in the d-dimensional space that iswithin a threshold area associated with a visual concept. In thisexample, referencing FIG. 5, the n-embeddings 530 and 540 may beassociated with the visual concept associated with the threshold area570. In particular embodiments, the social-networking system 160 mayonly forgo the selection of a popular n-gram if it determines that thepopular n-gram is sufficiently associated with a visual concept. Inthese embodiments, there may need to be a threshold degree ofassociation between a popular n-gram and a visual concept before thesocial-networking system 160 forgoes selection of the popular n-gram.This threshold degree may be a threshold distance from the location of apoint on the d-dimensional space where a visual concept is estimated tobe. As an example and not by way of limitation, referencing FIG. 5, then-embedding 530 may be sufficiently associated with the visual conceptcorresponding to the point 580 (because it may be within the thresholddistance from the point 580), but the n-embedding 540 may not besufficiently associated with the same visual concept even though it iswithin the threshold area (because it may not be within the thresholddistance from the point 580). In particular embodiments, thesocial-networking system 160 may only forgo such selection if thepopular n-gram is associated with a threshold number of visual concepts(e.g., three visual concepts). Although this disclosure describesselecting for training particular n-grams in a particular manner, itcontemplates selecting for training any suitable n-grams (or othersearch units) in any suitable manner.

In particular embodiments, the social-networking system 160 may selectspecific visual concepts for training the visual-concept recognitionsystem. In particular embodiments, specific visual concepts may beselected based on whether the specific visual concepts are sufficientlyrepresented by n-grams. As an example and not by way of limitation, thesocial-networking system 160 may determine whether a specific visualconcept is sufficiently represented based on the number of n-embeddingsin the joint embedding space that are within a threshold area of thespecific visual concept. In particular embodiments, the determination asto whether a visual concept and its descriptor n-grams are sufficientlyrepresented may be based on distribution data reflecting the percentageof visual-media items on the social-networking system 160 that includeor are expected to include a visual concept. In particular embodiments,the social-networking system 160 may access distribution data thatclassifies visual-media items in a sample set as including one or morecategories of visual concepts (e.g., using a supervised learningsystem). The social-networking system 160 may estimate, based on thedistribution data, projected frequencies for each of the one or morecategories of visual concepts in a larger set of visual-media items,wherein each projected frequency describes a number of visual-mediaitems in the larger set that are predicted to include one or more visualconcepts of the respective category of visual concepts. As an exampleand not by way of limitation, if 20% of visual-media items in the sampleset are determined to include a visual concept in the category “FoodItems,” the social-networking system 160 may estimate a projectedfrequency of 20% for this category in the larger set, such that it maybe expected that about 20% of visual-media items in the larger setinclude a visual concept in the category “Food Items.” Thesocial-networking system 160 may then determine based on the projectedfrequencies whether there exists a representative number of n-gramassociations with each category. Building on the previous example andnot by way of limitation, the social-networking system 160 may determinewhether there is a representative number of n-gram associations withvisual concepts of the category “Food Items” based on the projectedfrequency of 20%. If there is not a representative number of suchassociations, the social-networking system 160 may focus on training forvisual concepts related to this category. In particular embodiments, thesocial-networking system 160 may use a supervised training process totrain for specific visual concepts or categories of visual concepts. Thesupervised training process may include the use of human reviewers tomanually train visual concepts (e.g., by associating the visual conceptswith one or more appropriate n-grams). As an example and not by way oflimitation, the social-networking system 160 may use a human reviewer totrain the social-networking system 160 on what the visual concept for“mountain” may look like (e.g., by associating the n-gram “mountain”with one or more visual-media items depicting what a human wouldrecognize as a mountain).

In particular embodiments, the social-networking system 160 may employ asupervised training process that uses human evaluators to check whethern-grams associated with visual concepts correctly describes therespective visual concepts and/or whether visual-media items associatedwith a visual concept correctly includes that visual concept. Inparticular embodiments, a similar supervised training process maydetermine whether it is even possible for particular segments(incorrectly) identified as visual concepts are actually visualconcepts. As an example and not by way of limitation, thesocial-networking system 160 may (incorrectly) identify a segment in animage that a human would not recognize as any visual concept. In thisexample, a human evaluator may determine that the segment does notdepict a visual concept and may, for example, remove n-gram associationswith the segment. In particular embodiments, a similar supervisedlearning process may determine that certain visual concepts, even thoughthey may be recognizable as a visual concept, are simply unlikely toever be discussed in a communication (or described in metadata such astitles or descriptions) and similarly may be unlikely to be searched foras a visual concept in a search query for visual-media items. Inparticular embodiments, a similar supervised training process maydetermine whether one or more visual concepts are even capable of beingdescribed by n-grams. In particular embodiments, a similar supervisedtraining process may determine whether particular n-grams can correctlybe associated with visual concepts. As an example and not by way oflimitation, the n-gram “nothing” may frequently appear in communicationsincluding visual-media items that depict a particular visual concept,but a human evaluator may determine that there is no visual concept thatcan correctly be associated with “nothing” (i.e., that a human would notrecognize a visual concept as a depiction of “nothing”). The supervisedtraining process may, as an alternative to or in addition to humanevaluators, use a suitable index (e.g., a media-index, a text-index,etc.) to make these determinations. As an example and not by way oflimitation, the social-networking system 160 may match the n-gram “cat”against a text-index that indexes text to social-graph concepts todetermine that it relates to the social-graph concept “Cat,” which mayallow the social-networking system 160 to check a visual conceptassociated with the n-gram “cat” against images indexed (e.g., on theonline social network, on a third-party database) with the social-graphconcept “Cat.” Similar to the previous example and not by way oflimitation, the social-networking system 160 may identify a visualconcept in a visual-media item of what a human would recognize as a catand match it against a media-index that indexes media items to conceptsto determine that it relates to the social-graph concept “Cat.” Thesupervised training process may also use other metrics such asclick-through rate to determine if an n-gram has been properly trainedwith respect to a visual concept. As an example and not by way oflimitation, if querying users who submitted a search query including then-gram “yeezy” frequently click on music videos or photos of the artistKanye West, the social-networking system 160 may determine that acurrent association of “yeezy” to a visual concept associated with KanyeWest is correct. In particular embodiments, the social-networking system160 may check the associations between an n-gram and a particular visualconcept based on whether querying users who submit search queriesincluding the n-gram subsequently request to access a visual-media itemincluding the particular visual concept. As an example and not by way oflimitation, the social-networking system 160 may determine the number oftimes querying users request to view the visual-media item, which mayhave been sent to the querying users (e.g., as a search resultcorresponding to the visual-media item on a search results interface).

In particular embodiments, the social-networking system 160 may updateassociations between n-grams and visual concepts. The updates may occurperiodically or may occur as necessary (e.g., when it is determined thata threshold number of n-grams are being used a threshold number of timesin communications associated with visual-media items having visualconcepts with which the n-grams as yet have no association). Inparticular embodiments, the social-networking system 160 may introducenew visual concepts, or n-grams, and/or remove existing ones from atotal set of visual concepts, or n-grams, that have been trained. Thismay ensure that the social-networking system 160 remains trained onvisual concepts and n-grams that people are currently searching for,without resources being wasted on unnecessary visual concepts andn-grams. In particular embodiments, whenever a difference in visualconcepts or n-grams to train for has been made and propagated (e.g.,when a new visual concept or n-gram is introduced, when an existingvisual concept or n-gram is removed), new associations may be madebetween visual-media items and n-grams using the visual-conceptrecognition system. The new associations may be made either selectively(based on popularity or recency of the visual-media items or n-grams) orcompletely (for all visual-media items and n-grams).

FIG. 7 illustrates an example method 700 for selecting n-grams fortraining a visual-concept recognition system. The method may begin atstep 710, where the social-networking system 160 may receive, from aplurality of client systems 130 of a plurality of users, a plurality ofsearch queries, each search query comprising one or more n-grams. Atstep 720, the social-networking system 160 may identify a subset ofsearch queries from the plurality of search queries as being queries forvisual-media items, each of the search queries in the subset of searchqueries being identified based on one or more n-grams of the searchquery being associated with visual-media content. At step 730, thesocial-networking system 160 may calculate, for each of the n-grams ofthe search queries of the subset of search queries, a popularity-scorebased on a count of the search queries in the subset of search queriesthat include the n-gram. At step 740, the social-networking system 160may determine one or more popular n-gram, wherein each of the popularn-grams is an n-gram of the search queries of the subset of searchqueries having a popularity-score greater than a thresholdpopularity-score. At step 750, the social-networking system 160 mayselect one or more of the popular n-grams for training a visual-conceptrecognition system, wherein each of the popular n-grams is selectedbased on whether it is associated with one or more visual concepts.Particular embodiments may repeat one or more steps of the method ofFIG. 7, where appropriate. Although this disclosure describes andillustrates particular steps of the method of FIG. 7 as occurring in aparticular order, this disclosure contemplates any suitable steps of themethod of FIG. 7 occurring in any suitable order. Moreover, althoughthis disclosure describes and illustrates an example method forselecting n-grams for training a visual-concept recognition systemincluding the particular steps of the method of FIG. 7, this disclosurecontemplates any suitable method for selecting n-grams for training avisual-concept recognition system including any suitable steps, whichmay include all, some, or none of the steps of the method of FIG. 7,where appropriate. Furthermore, although this disclosure describes andillustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 7, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 7.

Social Graph Affinity and Coefficient

In particular embodiments, the social-networking system 160 maydetermine the social-graph affinity (which may be referred to herein as“affinity”) of various social-graph entities for each other. Affinitymay represent the strength of a relationship or level of interestbetween particular objects associated with the online social network,such as users, concepts, content, actions, advertisements, other objectsassociated with the online social network, or any suitable combinationthereof. Affinity may also be determined with respect to objectsassociated with third-party systems 170 or other suitable systems. Anoverall affinity for a social-graph entity for each user, subjectmatter, or type of content may be established. The overall affinity maychange based on continued monitoring of the actions or relationshipsassociated with the social-graph entity. Although this disclosuredescribes determining particular affinities in a particular manner, thisdisclosure contemplates determining any suitable affinities in anysuitable manner.

In particular embodiments, the social-networking system 160 may measureor quantify social-graph affinity using an affinity coefficient (whichmay be referred to herein as “coefficient”). The coefficient mayrepresent or quantify the strength of a relationship between particularobjects associated with the online social network. The coefficient mayalso represent a probability or function that measures a predictedprobability that a user will perform a particular action based on theuser's interest in the action. In this way, a user's future actions maybe predicted based on the user's prior actions, where the coefficientmay be calculated at least in part on the history of the user's actions.Coefficients may be used to predict any number of actions, which may bewithin or outside of the online social network. As an example and not byway of limitation, these actions may include various types ofcommunications, such as sending messages, posting content, or commentingon content; various types of observation actions, such as accessing orviewing profile interfaces, media, or other suitable content; varioustypes of coincidence information about two or more social-graphentities, such as being in the same group, tagged in the samephotograph, checked-in at the same location, or attending the sameevent; or other suitable actions. Although this disclosure describesmeasuring affinity in a particular manner, this disclosure contemplatesmeasuring affinity in any suitable manner.

In particular embodiments, the social-networking system 160 may use avariety of factors to calculate a coefficient. These factors mayinclude, for example, user actions, types of relationships betweenobjects, location information, other suitable factors, or anycombination thereof. In particular embodiments, different factors may beweighted differently when calculating the coefficient. The weights foreach factor may be static or the weights may change according to, forexample, the user, the type of relationship, the type of action, theuser's location, and so forth. Ratings for the factors may be combinedaccording to their weights to determine an overall coefficient for theuser. As an example and not by way of limitation, particular useractions may be assigned both a rating and a weight while a relationshipassociated with the particular user action is assigned a rating and acorrelating weight (e.g., so the weights total 100%). To calculate thecoefficient of a user towards a particular object, the rating assignedto the user's actions may comprise, for example, 60% of the overallcoefficient, while the relationship between the user and the object maycomprise 40% of the overall coefficient. In particular embodiments, thesocial-networking system 160 may consider a variety of variables whendetermining weights for various factors used to calculate a coefficient,such as, for example, the time since information was accessed, decayfactors, frequency of access, relationship to information orrelationship to the object about which information was accessed,relationship to social-graph entities connected to the object, short- orlong-term averages of user actions, user feedback, other suitablevariables, or any combination thereof. As an example and not by way oflimitation, a coefficient may include a decay factor that causes thestrength of the signal provided by particular actions to decay withtime, such that more recent actions are more relevant when calculatingthe coefficient. The ratings and weights may be continuously updatedbased on continued tracking of the actions upon which the coefficient isbased. Any type of process or algorithm may be employed for assigning,combining, averaging, and so forth the ratings for each factor and theweights assigned to the factors. In particular embodiments, thesocial-networking system 160 may determine coefficients usingmachine-learning algorithms trained on historical actions and past userresponses, or data farmed from users by exposing them to various optionsand measuring responses. Although this disclosure describes calculatingcoefficients in a particular manner, this disclosure contemplatescalculating coefficients in any suitable manner.

In particular embodiments, the social-networking system 160 maycalculate a coefficient based on a user's actions. The social-networkingsystem 160 may monitor such actions on the online social network, on athird-party system 170, on other suitable systems, or any combinationthereof. Any suitable type of user actions may be tracked or monitored.Typical user actions include viewing profile interfaces, creating orposting content, interacting with content, tagging or being tagged inimages, joining groups, listing and confirming attendance at events,checking-in at locations, liking particular interfaces, creatinginterfaces, and performing other tasks that facilitate social action. Inparticular embodiments, the social-networking system 160 may calculate acoefficient based on the user's actions with particular types ofcontent. The content may be associated with the online social network, athird-party system 170, or another suitable system. The content mayinclude users, profile interfaces, posts, news stories, headlines,instant messages, chat room conversations, emails, advertisements,pictures, video, music, other suitable objects, or any combinationthereof. The social-networking system 160 may analyze a user's actionsto determine whether one or more of the actions indicate an affinity forsubject matter, content, other users, and so forth. As an example andnot by way of limitation, if a user frequently posts content related to“coffee” or variants thereof, the social-networking system 160 maydetermine the user has a high coefficient with respect to the concept“coffee”. Particular actions or types of actions may be assigned ahigher weight and/or rating than other actions, which may affect theoverall calculated coefficient. As an example and not by way oflimitation, if a first user emails a second user, the weight or therating for the action may be higher than if the first user simply viewsthe user-profile interface for the second user.

In particular embodiments, the social-networking system 160 maycalculate a coefficient based on the type of relationship betweenparticular objects. Referencing the social graph 200, thesocial-networking system 160 may analyze the number and/or type of edges206 connecting particular user nodes 202 and concept nodes 204 whencalculating a coefficient. As an example and not by way of limitation,user nodes 202 that are connected by a spouse-type edge (representingthat the two users are married) may be assigned a higher coefficientthan a user nodes 202 that are connected by a friend-type edge. In otherwords, depending upon the weights assigned to the actions andrelationships for the particular user, the overall affinity may bedetermined to be higher for content about the user's spouse than forcontent about the user's friend. In particular embodiments, therelationships a user has with another object may affect the weightsand/or the ratings of the user's actions with respect to calculating thecoefficient for that object. As an example and not by way of limitation,if a user is tagged in a first photo, but merely likes a second photo,the social-networking system 160 may determine that the user has ahigher coefficient with respect to the first photo than the second photobecause having a tagged-in-type relationship with content may beassigned a higher weight and/or rating than having a like-typerelationship with content. In particular embodiments, thesocial-networking system 160 may calculate a coefficient for a firstuser based on the relationship one or more second users have with aparticular object. In other words, the connections and coefficientsother users have with an object may affect the first user's coefficientfor the object. As an example and not by way of limitation, if a firstuser is connected to or has a high coefficient for one or more secondusers, and those second users are connected to or have a highcoefficient for a particular object, the social-networking system 160may determine that the first user should also have a relatively highcoefficient for the particular object. In particular embodiments, thecoefficient may be based on the degree of separation between particularobjects. The lower coefficient may represent the decreasing likelihoodthat the first user will share an interest in content objects of theuser that is indirectly connected to the first user in the social graph200. As an example and not by way of limitation, social-graph entitiesthat are closer in the social graph 200 (i.e., fewer degrees ofseparation) may have a higher coefficient than entities that are furtherapart in the social graph 200.

In particular embodiments, the social-networking system 160 maycalculate a coefficient based on location information. Objects that aregeographically closer to each other may be considered to be more relatedor of more interest to each other than more distant objects. Inparticular embodiments, the coefficient of a user towards a particularobject may be based on the proximity of the object's location to acurrent location associated with the user (or the location of a clientsystem 130 of the user). A first user may be more interested in otherusers or concepts that are closer to the first user. As an example andnot by way of limitation, if a user is one mile from an airport and twomiles from a gas station, the social-networking system 160 may determinethat the user has a higher coefficient for the airport than the gasstation based on the proximity of the airport to the user.

In particular embodiments, the social-networking system 160 may performparticular actions with respect to a user based on coefficientinformation. Coefficients may be used to predict whether a user willperform a particular action based on the user's interest in the action.A coefficient may be used when generating or presenting any type ofobjects to a user, such as advertisements, search results, news stories,media, messages, notifications, or other suitable objects. Thecoefficient may also be utilized to rank and order such objects, asappropriate. In this way, the social-networking system 160 may provideinformation that is relevant to user's interests and currentcircumstances, increasing the likelihood that they will find suchinformation of interest. In particular embodiments, thesocial-networking system 160 may generate content based on coefficientinformation. Content objects may be provided or selected based oncoefficients specific to a user. As an example and not by way oflimitation, the coefficient may be used to generate media for the user,where the user may be presented with media for which the user has a highoverall coefficient with respect to the media object. As another exampleand not by way of limitation, the coefficient may be used to generateadvertisements for the user, where the user may be presented withadvertisements for which the user has a high overall coefficient withrespect to the advertised object. In particular embodiments, thesocial-networking system 160 may generate search results based oncoefficient information. Search results for a particular user may bescored or ranked based on the coefficient associated with the searchresults with respect to the querying user. As an example and not by wayof limitation, search results corresponding to objects with highercoefficients may be ranked higher on a search-results interface thanresults corresponding to objects having lower coefficients.

In particular embodiments, the social-networking system 160 maycalculate a coefficient in response to a request for a coefficient froma particular system or process. To predict the likely actions a user maytake (or may be the subject of) in a given situation, any process mayrequest a calculated coefficient for a user. The request may alsoinclude a set of weights to use for various factors used to calculatethe coefficient. This request may come from a process running on theonline social network, from a third-party system 170 (e.g., via an APIor other communication channel), or from another suitable system. Inresponse to the request, the social-networking system 160 may calculatethe coefficient (or access the coefficient information if it haspreviously been calculated and stored). In particular embodiments, thesocial-networking system 160 may measure an affinity with respect to aparticular process. Different processes (both internal and external tothe online social network) may request a coefficient for a particularobject or set of objects. The social-networking system 160 may provide ameasure of affinity that is relevant to the particular process thatrequested the measure of affinity. In this way, each process receives ameasure of affinity that is tailored for the different context in whichthe process will use the measure of affinity.

In connection with social-graph affinity and affinity coefficients,particular embodiments may utilize one or more systems, components,elements, functions, methods, operations, or steps disclosed in U.S.patent application Ser. No. 11/503,093, filed 11 Aug. 2006, U.S. patentapplication Ser. No. 12/977,027, filed 22 Dec. 2010, U.S. patentapplication Ser. No. 12/978,265, filed 23 Dec. 2010, and U.S. patentapplication Ser. No. 13/632,869, filed 1 Oct. 2012, each of which isincorporated by reference.

Advertising

In particular embodiments, an advertisement may be text (which may beHTML-linked), one or more images (which may be HTML-linked), one or morevideos, audio, one or more ADOBE FLASH files, a suitable combination ofthese, or any other suitable advertisement in any suitable digitalformat presented on one or more web interfaces, in one or more e-mails,or in connection with search results requested by a user. In addition oras an alternative, an advertisement may be one or more sponsored stories(e.g., a news-feed or ticker item on the social-networking system 160).A sponsored story may be a social action by a user (such as “liking” aninterface, “liking” or commenting on a post on an interface, RSVPing toan event associated with an interface, voting on a question posted on aninterface, checking in to a place, using an application or playing agame, or “liking” or sharing a website) that an advertiser promotes, forexample, by having the social action presented within a pre-determinedarea of a profile interface of a user or other interface, presented withadditional information associated with the advertiser, bumped up orotherwise highlighted within news feeds or tickers of other users, orotherwise promoted. The advertiser may pay to have the social actionpromoted. As an example and not by way of limitation, advertisements maybe included among the search results of a search-results interface,where sponsored content is promoted over non-sponsored content.

In particular embodiments, an advertisement may be requested for displaywithin social-networking-system web interfaces, third-party webinterfaces, or other interfaces. An advertisement may be displayed in adedicated portion of an interface, such as in a banner area at the topof the interface, in a column at the side of the interface, in a GUIwithin the interface, in a pop-up window, in a drop-down menu, in aninput field of the interface, over the top of content of the interface,or elsewhere with respect to the interface. In addition or as analternative, an advertisement may be displayed within an application. Anadvertisement may be displayed within dedicated interfaces, requiringthe user to interact with or watch the advertisement before the user mayaccess an interface or utilize an application. The user may, for exampleview the advertisement through a web browser.

A user may interact with an advertisement in any suitable manner. Theuser may click or otherwise select the advertisement. By selecting theadvertisement, the user may be directed to (or a browser or otherapplication being used by the user) an interface associated with theadvertisement. At the interface associated with the advertisement, theuser may take additional actions, such as purchasing a product orservice associated with the advertisement, receiving informationassociated with the advertisement, or subscribing to a newsletterassociated with the advertisement. An advertisement with audio or videomay be played by selecting a component of the advertisement (like a“play button”). Alternatively, by selecting the advertisement, thesocial-networking system 160 may execute or modify a particular actionof the user.

An advertisement may also include social-networking-system functionalitythat a user may interact with. As an example and not by way oflimitation, an advertisement may enable a user to “like” or otherwiseendorse the advertisement by selecting an icon or link associated withendorsement. As another example and not by way of limitation, anadvertisement may enable a user to search (e.g., by executing a query)for content related to the advertiser. Similarly, a user may share theadvertisement with another user (e.g., through the social-networkingsystem 160) or RSVP (e.g., through the social-networking system 160) toan event associated with the advertisement. In addition or as analternative, an advertisement may include social-networking-systemcontent directed to the user. As an example and not by way oflimitation, an advertisement may display information about a friend ofthe user within the social-networking system 160 who has taken an actionassociated with the subject matter of the advertisement.

Systems and Methods

FIG. 8 illustrates an example computer system 800. In particularembodiments, one or more computer systems 800 perform one or more stepsof one or more methods described or illustrated herein. In particularembodiments, one or more computer systems 800 provide functionalitydescribed or illustrated herein. In particular embodiments, softwarerunning on one or more computer systems 800 performs one or more stepsof one or more methods described or illustrated herein or providesfunctionality described or illustrated herein. Particular embodimentsinclude one or more portions of one or more computer systems 800.Herein, reference to a computer system may encompass a computing device,and vice versa, where appropriate. Moreover, reference to a computersystem may encompass one or more computer systems, where appropriate.

This disclosure contemplates any suitable number of computer systems800. This disclosure contemplates computer system 800 taking anysuitable physical form. As example and not by way of limitation,computer system 800 may be an embedded computer system, a system-on-chip(SOC), a single-board computer system (SBC) (such as, for example, acomputer-on-module (COM) or system-on-module (SOM)), a desktop computersystem, a laptop or notebook computer system, an interactive kiosk, amainframe, a mesh of computer systems, a mobile telephone, a personaldigital assistant (PDA), a server, a tablet computer system, anaugmented/virtual reality device, or a combination of two or more ofthese. Where appropriate, computer system 800 may include one or morecomputer systems 800; be unitary or distributed; span multiplelocations; span multiple machines; span multiple data centers; or residein a cloud, which may include one or more cloud components in one ormore networks. Where appropriate, one or more computer systems 800 mayperform without substantial spatial or temporal limitation one or moresteps of one or more methods described or illustrated herein. As anexample and not by way of limitation, one or more computer systems 800may perform in real time or in batch mode one or more steps of one ormore methods described or illustrated herein. One or more computersystems 800 may perform at different times or at different locations oneor more steps of one or more methods described or illustrated herein,where appropriate.

In particular embodiments, computer system 800 includes a processor 802,memory 804, storage 806, an input/output (I/O) interface 808, acommunication interface 810, and a bus 812. Although this disclosuredescribes and illustrates a particular computer system having aparticular number of particular components in a particular arrangement,this disclosure contemplates any suitable computer system having anysuitable number of any suitable components in any suitable arrangement.

In particular embodiments, processor 802 includes hardware for executinginstructions, such as those making up a computer program. As an exampleand not by way of limitation, to execute instructions, processor 802 mayretrieve (or fetch) the instructions from an internal register, aninternal cache, memory 804, or storage 806; decode and execute them; andthen write one or more results to an internal register, an internalcache, memory 804, or storage 806. In particular embodiments, processor802 may include one or more internal caches for data, instructions, oraddresses. This disclosure contemplates processor 802 including anysuitable number of any suitable internal caches, where appropriate. Asan example and not by way of limitation, processor 802 may include oneor more instruction caches, one or more data caches, and one or moretranslation lookaside buffers (TLBs). Instructions in the instructioncaches may be copies of instructions in memory 804 or storage 806, andthe instruction caches may speed up retrieval of those instructions byprocessor 802. Data in the data caches may be copies of data in memory804 or storage 806 for instructions executing at processor 802 tooperate on; the results of previous instructions executed at processor802 for access by subsequent instructions executing at processor 802 orfor writing to memory 804 or storage 806; or other suitable data. Thedata caches may speed up read or write operations by processor 802. TheTLBs may speed up virtual-address translation for processor 802. Inparticular embodiments, processor 802 may include one or more internalregisters for data, instructions, or addresses. This disclosurecontemplates processor 802 including any suitable number of any suitableinternal registers, where appropriate. Where appropriate, processor 802may include one or more arithmetic logic units (ALUs); be a multi-coreprocessor; or include one or more processors 802. Although thisdisclosure describes and illustrates a particular processor, thisdisclosure contemplates any suitable processor.

In particular embodiments, memory 804 includes main memory for storinginstructions for processor 802 to execute or data for processor 802 tooperate on. As an example and not by way of limitation, computer system800 may load instructions from storage 806 or another source (such as,for example, another computer system 800) to memory 804. Processor 802may then load the instructions from memory 804 to an internal registeror internal cache. To execute the instructions, processor 802 mayretrieve the instructions from the internal register or internal cacheand decode them. During or after execution of the instructions,processor 802 may write one or more results (which may be intermediateor final results) to the internal register or internal cache. Processor802 may then write one or more of those results to memory 804. Inparticular embodiments, processor 802 executes only instructions in oneor more internal registers or internal caches or in memory 804 (asopposed to storage 806 or elsewhere) and operates only on data in one ormore internal registers or internal caches or in memory 804 (as opposedto storage 806 or elsewhere). One or more memory buses (which may eachinclude an address bus and a data bus) may couple processor 802 tomemory 804. Bus 812 may include one or more memory buses, as describedbelow. In particular embodiments, one or more memory management units(MMUs) reside between processor 802 and memory 804 and facilitateaccesses to memory 804 requested by processor 802. In particularembodiments, memory 804 includes random access memory (RAM). This RAMmay be volatile memory, where appropriate Where appropriate, this RAMmay be dynamic RAM (DRAM) or static RAM (SRAM). Moreover, whereappropriate, this RAM may be single-ported or multi-ported RAM. Thisdisclosure contemplates any suitable RAM. Memory 804 may include one ormore memories 804, where appropriate. Although this disclosure describesand illustrates particular memory, this disclosure contemplates anysuitable memory.

In particular embodiments, storage 806 includes mass storage for data orinstructions. As an example and not by way of limitation, storage 806may include a hard disk drive (HDD), a floppy disk drive, flash memory,an optical disc, a magneto-optical disc, magnetic tape, or a UniversalSerial Bus (USB) drive or a combination of two or more of these. Storage806 may include removable or non-removable (or fixed) media, whereappropriate. Storage 806 may be internal or external to computer system800, where appropriate. In particular embodiments, storage 806 isnon-volatile, solid-state memory. In particular embodiments, storage 806includes read-only memory (ROM). Where appropriate, this ROM may bemask-programmed ROM, programmable ROM (PROM), erasable PROM (EPROM),electrically erasable PROM (EEPROM), electrically alterable ROM (EAROM),or flash memory or a combination of two or more of these. Thisdisclosure contemplates mass storage 806 taking any suitable physicalform. Storage 806 may include one or more storage control unitsfacilitating communication between processor 802 and storage 806, whereappropriate. Where appropriate, storage 806 may include one or morestorages 806. Although this disclosure describes and illustratesparticular storage, this disclosure contemplates any suitable storage.

In particular embodiments, I/O interface 808 includes hardware,software, or both, providing one or more interfaces for communicationbetween computer system 800 and one or more I/O devices. Computer system800 may include one or more of these I/O devices, where appropriate. Oneor more of these I/O devices may enable communication between a personand computer system 800. As an example and not by way of limitation, anI/O device may include a keyboard, keypad, microphone, monitor, mouse,printer, scanner, speaker, still camera, stylus, tablet, touch screen,trackball, video camera, another suitable I/O device or a combination oftwo or more of these. An I/O device may include one or more sensors.This disclosure contemplates any suitable I/O devices and any suitableI/O interfaces 808 for them. Where appropriate, I/O interface 808 mayinclude one or more device or software drivers enabling processor 802 todrive one or more of these I/O devices. I/O interface 808 may includeone or more I/O interfaces 808, where appropriate. Although thisdisclosure describes and illustrates a particular I/O interface, thisdisclosure contemplates any suitable I/O interface.

In particular embodiments, communication interface 810 includeshardware, software, or both providing one or more interfaces forcommunication (such as, for example, packet-based communication) betweencomputer system 800 and one or more other computer systems 800 or one ormore networks. As an example and not by way of limitation, communicationinterface 810 may include a network interface controller (NIC) ornetwork adapter for communicating with an Ethernet or other wire-basednetwork or a wireless NIC (WNIC) or wireless adapter for communicatingwith a wireless network, such as a WI-FI network. This disclosurecontemplates any suitable network and any suitable communicationinterface 810 for it. As an example and not by way of limitation,computer system 800 may communicate with an ad hoc network, a personalarea network (PAN), a local area network (LAN), a wide area network(WAN), a metropolitan area network (MAN), or one or more portions of theInternet or a combination of two or more of these. One or more portionsof one or more of these networks may be wired or wireless. As anexample, computer system 800 may communicate with a wireless PAN (WPAN)(such as, for example, a BLUETOOTH WPAN), a WI-FI network, a WI-MAXnetwork, a cellular telephone network (such as, for example, a GlobalSystem for Mobile Communications (GSM) network), or other suitablewireless network or a combination of two or more of these. Computersystem 800 may include any suitable communication interface 810 for anyof these networks, where appropriate. Communication interface 810 mayinclude one or more communication interfaces 810, where appropriate.Although this disclosure describes and illustrates a particularcommunication interface, this disclosure contemplates any suitablecommunication interface.

In particular embodiments, bus 812 includes hardware, software, or bothcoupling components of computer system 800 to each other. As an exampleand not by way of limitation, bus 812 may include an AcceleratedGraphics Port (AGP) or other graphics bus, an Enhanced Industry StandardArchitecture (EISA) bus, a front-side bus (FSB), a HYPERTRANSPORT (HT)interconnect, an Industry Standard Architecture (ISA) bus, an INFINIBANDinterconnect, a low-pin-count (LPC) bus, a memory bus, a Micro ChannelArchitecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, aPCI-Express (PCIe) bus, a serial advanced technology attachment (SATA)bus, a Video Electronics Standards Association local (VLB) bus, oranother suitable bus or a combination of two or more of these. Bus 812may include one or more buses 812, where appropriate. Although thisdisclosure describes and illustrates a particular bus, this disclosurecontemplates any suitable bus or interconnect.

Herein, a computer-readable non-transitory storage medium or media mayinclude one or more semiconductor-based or other integrated circuits(ICs) (such, as for example, field-programmable gate arrays (FPGAs) orapplication-specific ICs (ASICs)), hard disk drives (HDDs), hybrid harddrives (HHDs), optical discs, optical disc drives (ODDs),magneto-optical discs, magneto-optical drives, floppy diskettes, floppydisk drives (FDDs), magnetic tapes, solid-state drives (SSDs),RAM-drives, SECURE DIGITAL cards or drives, any other suitablecomputer-readable non-transitory storage media, or any suitablecombination of two or more of these, where appropriate. Acomputer-readable non-transitory storage medium may be volatile,non-volatile, or a combination of volatile and non-volatile, whereappropriate.

Herein, “or” is inclusive and not exclusive, unless expressly indicatedotherwise or indicated otherwise by context. Therefore, herein, “A or B”means “A, B, or both,” unless expressly indicated otherwise or indicatedotherwise by context. Moreover, “and” is both joint and several, unlessexpressly indicated otherwise or indicated otherwise by context.Therefore, herein, “A and B” means “A and B, jointly or severally,”unless expressly indicated otherwise or indicated otherwise by context.

The scope of this disclosure encompasses all changes, substitutions,variations, alterations, and modifications to the example embodimentsdescribed or illustrated herein that a person having ordinary skill inthe art would comprehend. The scope of this disclosure is not limited tothe example embodiments described or illustrated herein. Moreover,although this disclosure describes and illustrates respectiveembodiments herein as including particular components, elements,feature, functions, operations, or steps, any of these embodiments mayinclude any combination or permutation of any of the components,elements, features, functions, operations, or steps described orillustrated anywhere herein that a person having ordinary skill in theart would comprehend. Furthermore, reference in the appended claims toan apparatus or system or a component of an apparatus or system beingadapted to, arranged to, capable of, configured to, enabled to, operableto, or operative to perform a particular function encompasses thatapparatus, system, component, whether or not it or that particularfunction is activated, turned on, or unlocked, as long as thatapparatus, system, or component is so adapted, arranged, capable,configured, enabled, operable, or operative. Additionally, although thisdisclosure describes or illustrates particular embodiments as providingparticular advantages, particular embodiments may provide none, some, orall of these advantages.

The invention claimed is:
 1. A method comprising, by one or morecomputing systems: receiving, from a plurality of client systems of aplurality of users, a plurality of search queries, each search querycomprising one or more n-grams; identifying a subset of search queriesfrom the plurality of search queries as being queries for visual-mediaitems, each of the search queries in the subset of search queries beingidentified based on one or more n-grams of the search query beingassociated with visual-media content; calculating, for each of then-grams of the search queries of the subset of search queries, apopularity-score based on a count of the search queries in the subset ofsearch queries that include the n-gram, wherein, for each of one or moreof the n-grams of the search queries of the subset of search queries,the count of the search queries including the n-gram is a weighted countthat weights an occurrence of each search query based on a degree ofconfidence with which the search query is identified as being a queryfor visual-media items; determining one or more popular n-grams, whereineach of the popular n-grams is an n-gram of the search queries of thesubset of search queries having a popularity-score greater than athreshold popularity-score; and selecting one or more of the popularn-grams for training a visual-concept recognition system, wherein eachof the popular n-grams is selected based on whether it is associatedwith one or more visual concepts.
 2. The method of claim 1, furthercomprising: accessing a social graph comprising a plurality of nodes anda plurality of edges connecting the nodes, each of the edges between twoof the nodes representing a single degree of separation between them,the nodes comprising: a first node corresponding to a user associatedwith an online social network; and a plurality of second nodes that eachcorrespond to a visual-media item or a visual concept associated withthe online social network.
 3. The method of claim 1, wherein each of oneor more of the search queries in the subset of search queries is furtheridentified based on a number of visual-media items that match the searchquery.
 4. The method of claim 1, wherein each of one or more of thesearch queries in the subset of search queries is further identifiedbased on a number of times that prior searches including one or moren-grams of the search query resulted in a user requesting to access avisual-media item.
 5. The method of claim 1, wherein each of one or moreof the search queries in the subset of search queries is furtheridentified based on whether it is a bounded search query thatspecifically filters for search results having visual-media content. 6.The method of claim 1, wherein each of one or more of the search queriesin the subset of search queries is further identified based on a searchcontext from which the search query is submitted.
 7. The method of claim1, wherein the weighted count further weights the occurrence of eachsearch query based on information associated with a user of a clientsystem from which the search query was received.
 8. The method of claim7, wherein the information associated with the user comprisesdemographic information of the user.
 9. The method of claim 7, whereinthe information associated with the user comprises geo-locationinformation of the user, the geo-location information being determinedbased on a geo-location of the client system from which the search queryis received.
 10. The method of claim 7, wherein the informationassociated with the user comprises a search history of the user.
 11. Themethod of claim 1, further comprising determining whether each of thepopular n-grams is associated with a particular visual concept based onan analysis of a joint-embedding model, the analysis comprising, foreach of the popular n-grams: determining if an embedding for the popularn-gram is within a threshold area of embeddings for one or morevisual-media items that include the particular visual concept.
 12. Themethod of claim 1, further comprising selecting one or more visualconcepts for training the visual-concept recognition system, wherein theselecting comprises: accessing distribution data that classifiesvisual-media items in a sample set as including one or more categoriesof visual concepts; estimating, based on the distribution data,projected frequencies for each of the one or more categories of visualconcepts in a larger set of visual-media items, wherein each projectedfrequency describes a frequency of occurrence of the respective categoryof visual concepts in the larger set that are predicted to include oneor more visual concepts of the respective category of visual concepts;and determining, based on the projected frequencies, whether thereexists a representative number of n-gram associations with one or morevisual concepts of each category of visual concepts.
 13. The method ofclaim 12, further comprising receiving inputs from one or more humanevaluators specifying whether or not each of one or more of the visualconcepts is capable of being described by n-grams.
 14. The method ofclaim 1, further comprising using a supervised training process to trainthe popular n-grams selected for training the visual-concept recognitionsystem, wherein the supervised training process comprises receivinginputs from one or more human evaluators associating the popular n-gramswith one or more visual concepts.
 15. The method of claim 1, furthercomprising: receiving, from a client system of a particular user, asearch query comprising one or more n-grams that are associated with aparticular visual concept; sending, to the client system of theparticular user, one or more visual-media items that include theparticular visual concept; and determining whether the client system ofthe particular user subsequently requests to access one or more of thevisual-media items that include the particular visual concept.
 16. Themethod of claim 1, further comprising, for one or more n-grams,periodically updating the respective associations with visual concepts.17. One or more computer-readable non-transitory storage media embodyingsoftware that is operable when executed to: receive, from a plurality ofclient systems of a plurality of users, a plurality of search queries,each search query comprising one or more n-grams; identify a subset ofsearch queries from the plurality of search queries as being queries forvisual-media items, each of the search queries in the subset of searchqueries being identified based on one or more n-grams of the searchquery being associated with visual-media content; calculate, for each ofthe n-grams of the search queries of the subset of search queries, apopularity-score based on a count of the search queries in the subset ofsearch queries that include the n-gram, wherein, for each of one or moreof the n-grams of the search queries of the subset of search queries,the count of the search queries including the n-gram is a weighted countthat weights an occurrence of each search query based on a degree ofconfidence with which the search query is identified as being a queryfor visual-media items; determine one or more popular n-gram, whereineach of the popular n-grams is an n-gram of the search queries of thesubset of search queries having a popularity-score greater than athreshold popularity-score; and select one or more of the popularn-grams for training a visual-concept recognition system, wherein eachof the popular n-grams is selected based on whether it is associatedwith one or more visual concepts.
 18. The media of claim 17, furthercomprising determining whether each of the popular n-grams is associatedwith a particular visual concept based on an analysis of ajoint-embedding model, the analysis comprising, for each of the popularn-grams: determining if an embedding for the popular n-gram is within athreshold area of embeddings for one or more visual-media items thatinclude the particular visual concept.
 19. A system comprising: one ormore processors; and a non-transitory memory coupled to the processorscomprising instructions executable by the processors, the processorsoperable when executing the instructions to: receive, from a pluralityof client systems of a plurality of users, a plurality of searchqueries, each search query comprising one or more n-grams; identify asubset of search queries from the plurality of search queries as beingqueries for visual-media items, each of the search queries in the subsetof search queries being identified based on one or more n-grams of thesearch query being associated with visual-media content; calculate, foreach of the n-grams of the search queries of the subset of searchqueries, a popularity-score based on a count of the search queries inthe subset of search queries that include the n-gram, wherein, for eachof one or more of the n-grams of the search queries of the subset ofsearch queries, the count of the search queries including the n-gram isa weighted count that weights an occurrence of each search query basedon a degree of confidence with which the search query is identified asbeing a query for visual-media items; determine one or more popularn-gram, wherein each of the popular n-grams is an n-gram of the searchqueries of the subset of search queries having a popularity-scoregreater than a threshold popularity-score; and select one or more of thepopular n-grams for training a visual-concept recognition system,wherein each of the popular n-grams is selected based on whether it isassociated with one or more visual concepts.
 20. The media of claim 17,wherein the weighted count further weights the occurrence of each searchquery based on information associated with a user of a client systemfrom which the search query was received.